Exemplo n.º 1
0
def data_sparse(filename, feat_type):
    ''' This function takes as argument a file representing a sparse matrix
    sparse_matrix[i][j] = "a:b" means matrix[i][a] = b
    It converts it into a numpy array, using sparse_list_to_array function, and returns this array'''
    sparse_list = data_converter.sparse_file_to_sparse_list(filename)
    return data_converter.sparse_list_to_csr_sparse(sparse_list,
                                                    len(feat_type))
Exemplo n.º 2
0
def data_sparse (filename, nbr_features):
	''' This function takes as argument a file representing a sparse matrix
	sparse_matrix[i][j] = "a:b" means matrix[i][a] = b
	It converts it into a numpy array, using sparse_list_to_array function, and returns this array'''
	sparse_list = data_converter.sparse_file_to_sparse_list(filename)
	return data_converter.sparse_list_to_csr_sparse (sparse_list, nbr_features)