mapalign icon indicating copy to clipboard operation
mapalign copied to clipboard

Missing import for rbf kernel?

Open afrendeiro opened this issue 7 years ago • 1 comments

I get a NameError ( global name 'rbf_kernel' is not defined) when trying to use the rbf kernel (affinity='rbf'). Maybe this is missing an import from sklearn (sklearn.metrics.pairwise.rbf_kernel) to be used here?

afrendeiro avatar Aug 01 '17 16:08 afrendeiro

Indeed it is. There are a few import errors I've found so far in embed.py. So far I've added

import warnings
from scipy import sparse
from sklearn.neighbors import kneighbors_graph

If you want to use sparse matrices with the class, you'll need to change this line to

X = check_array(X, ensure_min_samples=2, estimator=self, accept_sparse=True)

otherwise the check will raise an exception. See the sklearn docs on check_array.

Deprecated since version 0.19: Passing ‘None’ to parameter accept_sparse in methods is deprecated in version 0.19 “and will be removed in 0.21. Use accept_sparse=False instead.

If you want to specify eigen_solver in the constructor, it must be a function rather than a string as the docs suggest.

Hope this helps you or someone else.

ckingdev avatar Dec 23 '17 11:12 ckingdev