(self, mat_shape, fill_value=1, sparse=True, sparse_format='lil_matrix')
return mask
Return an array which has the same shape with the label matrix.
        If an entry is known, then, the corresponding value in the mask is 1, otherwise, 0.

        Parameters
        ----------
        mat_shape: tuple
            The shape of label matrix. [n_samples, n_classes]

        fill_value: int
            The value filled in the mask when the entry is in the container.

        sparse: bool
            Whether to return a sparse matrix or a dense matrix (numpy.ndarray).

        sparse_format: str
            The format of the returned sparse matrix. Only available if sparse==True
            should be one onf [bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dia_matrix, dok_matrix, lil_matrix].
            Please refer to https://docs.scipy.org/doc/scipy-0.18.1/reference/sparse.html
            for the definition of each sparse format.

        Returns
        -------
        mask: {scipy.sparse.csr_matrix, scipy.sparse.csc_matrix}
            The mask of the label matrix.
Return an array which has the same shape with the label matrix.
        If an entry is known, then, the corresponding value in the mask is 1, otherwise, 0.
Return an array which has the same shape with the label matrix . If an entry is known then the corresponding value in the mask is 1 otherwise 0 .
def get_matrix_mask(self, mat_shape, fill_value=1, sparse=True, sparse_format='lil_matrix'):
        """Return an array which has the same shape with the label matrix.
        If an entry is known, then, the corresponding value in the mask is 1, otherwise, 0.

        Parameters
        ----------
        mat_shape: tuple
            The shape of label matrix. [n_samples, n_classes]

        fill_value: int
            The value filled in the mask when the entry is in the container.

        sparse: bool
            Whether to return a sparse matrix or a dense matrix (numpy.ndarray).

        sparse_format: str
            The format of the returned sparse matrix. Only available if sparse==True
            should be one onf [bsr_matrix, coo_matrix, csc_matrix, csr_matrix, dia_matrix, dok_matrix, lil_matrix].
            Please refer to https://docs.scipy.org/doc/scipy-0.18.1/reference/sparse.html
            for the definition of each sparse format.

        Returns
        -------
        mask: {scipy.sparse.csr_matrix, scipy.sparse.csc_matrix}
            The mask of the label matrix.
        """
        assert isinstance(mat_shape, tuple)
        if sparse:
            try:
                exec("from scipy.sparse import " + sparse_format)
            except:
                raise ValueError(
                    "sparse format " + sparse_format + "is not defined. Valid format should be one of "
                                                       "[bsr_matrix, coo_matrix, csc_matrix, csr_matrix, "
                                                       "dia_matrix, dok_matrix, lil_matrix].")
            mask = eval(sparse_format + '(mat_shape)')
        else:
            if fill_value == 1 or fill_value == True:
                mask = np.zeros(mat_shape, dtype=bool)
                for item in self._innercontainer:
                    mask[item] = True
            else:
                mask = np.zeros(mat_shape)
                for item in self._innercontainer:
                    mask[item] = fill_value
        return mask
def get_matrix_mask ( self , mat_shape , fill_value = 1 , sparse = True , sparse_format = 'lil_matrix' ) : assert isinstance ( mat_shape , tuple ) if sparse : try : exec ( "from scipy.sparse import " + sparse_format ) except : raise ValueError ( "sparse format " + sparse_format + "is not defined. Valid format should be one of " "[bsr_matrix, coo_matrix, csc_matrix, csr_matrix, " "dia_matrix, dok_matrix, lil_matrix]." ) mask = eval ( sparse_format + '(mat_shape)' ) else : if fill_value == 1 or fill_value == True : mask = np . zeros ( mat_shape , dtype = bool ) for item in self . _innercontainer : mask [ item ] = True else : mask = np . zeros ( mat_shape ) for item in self . _innercontainer : mask [ item ] = fill_value return mask