Comments (5)
I see. We will work on that feature.
from pacmap.
Have you tried to directly load the annoy instance? It could be done using something like this:
embedding = pacmap.PaCMAP() # initialize/load the saved pacmap instance
embedding.tree = load_annoy_tree() # your function that loads the annoy instance
from pacmap.
Hello! I did tried what you suggested, and even completed the others attributes that the method required to run:
u = AnnoyIndex(0)
u.load('test.ann')
embedding.tree = u
embedding.xmin = emb_model.xmin
embedding.xmax = emb_model.xmax
embedding.xmean = emb_model.xmean
embedding.tsvd_transformer = emb_model.tsvd_transformer
embedding.pair_FP = emb_model.pair_FP
embedding.pair_MN = emb_model.pair_MN
embedding.pair_neighbors = emb_model.pair_neighbors
embedding.n_neighbors = emb_model.n_neighbors
embedding.transform(feature_matrix_c)
But I still get:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/tmp/ipykernel_26194/902635302.py in <module>
----> 1 embedding.transform(feature_matrix_c)
/opt/conda/lib/python3.9/site-packages/pacmap/pacmap.py in transform(self, X, basis, init, save_pairs)
932 self.apply_pca, self.verbose)
933 # Sample pairs
--> 934 self.pair_XP = generate_extra_pair_basis(basis, X,
935 self.n_neighbors,
936 self.tree,
/opt/conda/lib/python3.9/site-packages/pacmap/pacmap.py in generate_extra_pair_basis(basis, X, n_neighbors, tree, distance, verbose)
417
418 for i in range(npr):
--> 419 nbrs[i, :], knn_distances[i, :] = tree.get_nns_by_vector(
420 X[i, :], n_neighbors_extra, include_distances=True)
421
IndexError: Vector has wrong length (expected 0, got 17)
from pacmap.
Seems like the problem is in your initialization of the AnnoyIndex. It seems like the number of dimensions you are using is 17, therefore for loading the annoy index, you should initialize it with u = AnnoyIndex(17)
instead of u = AnnoyIndex(0)
.
from pacmap.
For some reason I cannot load the saved PaCMAP with index 17. I have to load with index 18, but this crashes the transform function. Idk if this is a PaCMAP problem or annoy index problem.
But it would be nice to have a PaCMAP function to correctly save and load its models.
from pacmap.
Related Issues (20)
- Early stopping in third phase of training HOT 1
- Multiprocessor support HOT 5
- PaCMAP is stochastic with sparse data even if random seed is set HOT 7
- Possible bug: plotting intermediate snapshots HOT 3
- allow test/query data to be used with Transform() API call HOT 1
- Readme n_dims vs. n_components HOT 1
- Import performance HOT 2
- transform() doesn't work HOT 4
- Rainbow Plots For Bad Loss! HOT 1
- inverse_transform() in PaCMAP HOT 1
- Segmentation fault when running model in loop HOT 1
- Save a PaCMAP model HOT 2
- Error when the number of instances grow to large HOT 2
- Large-scale PaCMAP HOT 5
- `fit_transform` and `transform` on the same feature doesn't return the same value HOT 9
- speed up processing large dataset HOT 1
- Is `inverse_transform` possible with PaCMAP? HOT 1
- Add PaCMAP to Conda-forge please HOT 2
- Metric learning with PaCMAP? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pacmap.