[scikit-learn] cluster.affinity_propagation doesn't accept sparse?
Neal Becker
ndbecker2 at gmail.com
Wed Jan 23 15:01:13 EST 2019
It appears affinity propagation would appear to accept sparse similarity
input:
X = check_array(X, accept_sparse='csr')
But if I try it, I get:
~/.local/lib/python3.7/site-
packages/sklearn/cluster/affinity_propagation_.py in affinity_propagation(S,
preference, convergence_iter, max_iter, damping, copy, verbose,
return_n_iter)
137
138 # Place preference on the diagonal of S
--> 139 S.flat[::(n_samples + 1)] = preference
140
141 A = np.zeros((n_samples, n_samples))
~/.local/lib/python3.7/site-packages/scipy/sparse/base.py in
__getattr__(self, attr)
687 return self.getnnz()
688 else:
--> 689 raise AttributeError(attr + " not found")
690
691 def transpose(self, axes=None, copy=False):
AttributeError: flat not found
More information about the scikit-learn
mailing list