sensein / mapalign

Diffusion map based embedding and alignment
Other
68 stars 28 forks source link

Missing import for rbf kernel? #11

Open afrendeiro opened 7 years ago

afrendeiro commented 7 years ago

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?

ckingdev commented 6 years ago

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.