Closed
Description
Calling fit()
or fit_predict()
with a csr matrix as input crashes the code (when affinity != 'precomputed'
).
I've investigated the error a bit and found that X = np.asarray(X)
in the fit
method of affinity_propagation_.py is causing the error and should be replaced by sth like X = check_array(X, accept_sparse='csr')
as is done for DBSCAN.
Note:
Just re-checked, the problem does not happen with the latest stable release (scikit-learn==0.15.2) as the problematic line X = np.asarray(X)
is not in the fit()
method.
Minimal example to reproduce the error:
from sklearn.cluster import AffinityPropagation
from sklearn.datasets import fetch_20newsgroups_vectorized
b = fetch_20newsgroups_vectorized()
affinity = AffinityPropagation()
affinity.fit(b.data)
Setup:
scikit-learn==0.16.dev0
Metadata
Metadata
Assignees
Labels
No labels