YingfanWang / PaCMAP

PaCMAP: Large-scale Dimension Reduction Technique Preserving Both Global and Local Structure
Apache License 2.0
538 stars 54 forks source link

transform() doesn't work #41

Closed anniepank closed 1 year ago

anniepank commented 2 years ago

Try out calling .transform() after the fitting the dataset several times on the test set, the results will start converging to the same value for each item in the test batch.

hyhuang00 commented 2 years ago

Would you be able to elaborate on the problem? Why do you need to call transform for multiple times? How would the test data converge to each item in the test set?

anniepank commented 2 years ago

So the problem was the following: I first have trained a pacmap transformation on my training data x fit = pacmap.PaCMAP() transformed = fit.fit_transform(x, init='pca') and then I wanted to project the new datasets x2, x3 and so on onto the learned embedding space with: x2_transformed = fit.transform(x2, basis=x, init='pca')

however transform method changes the basis argument x during the call and therefore for the next calls like fit.transform(x3, basis=x, init='pca') the result becomes invalid, since x is not the same anymore. I have solved it by sending the copy of my basis x into the transform method like fit.transform(x3, basis=x.copy(), init='pca')

hyhuang00 commented 2 years ago

Thank you for reporting the undesired behavior! We will fix this problem soon.

hyhuang00 commented 1 year ago

This problem should have been fixed in the previous release of 0.7.0, so I'm closing this issue.