-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Type Error thrown for Isomap Embedding when calling fit with scipy.sparse.csr.csr_matrix #7426
Copy link
Copy link
Closed
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve
Description
Description
Type Error thrown for Isomap Embedding when calling fit when passing in sparse matrix
Steps/Code to Reproduce
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import Normalizer
from sklearn.manifold import Isomap
docs = ['Help I have a bug!' for x in range(1000)]
count_vectorizer = CountVectorizer(analyzer = 'word', ngram_range = (1,2), stop_words = 'english',
lowercase= True, max_features = None, binary = False)
normalizer = Normalizer(norm='l2')
doc_vecs = normalizer.fit_transform(count_vectorizer.fit_transform(docs))
isomap = Isomap(n_neighbors=5,
n_components=2,
eigen_solver='auto',
tol=0,
max_iter=None,
path_method='auto',
neighbors_algorithm='auto')
isomap.fit(doc_vecs)Expected Results
fit embedding
Actual Results
TypeError: A sparse matrix was passed, but dense data is required. Use X.toarray() to convert to a dense numpy array.
Versions
Darwin-15.6.0-x86_64-i386-64bit
('Python', '2.7.12 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:43:17) \n[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)]')
('NumPy', '1.11.1')
('SciPy', '0.17.1')
('Scikit-Learn', '0.17.1')
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
EasyWell-defined and straightforward way to resolveWell-defined and straightforward way to resolve