Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lf.batch_add(fingerprints) throws a bunch of vectors and die #72

Open
ScottLiao920 opened this issue Nov 29, 2024 · 1 comment
Open

Comments

@ScottLiao920
Copy link

ScottLiao920 commented Nov 29, 2024

Here's my code snippet:
`
perm = 128

lf = tm.LSHForest(perm)

fingerprints = [tm.VectorFloat(b) for b in all_embeds]

lf.batch_add(fingerprints)
`

where all_embeds is a numpy array of molecular fingerprints in float.
I tried python3.6, 3.9, and 3.10, all installed with conda install -c tmap tmap,
running as python script throws a bunch of vectors and then quit, running in notebook dies immediately.
Any idea on how to fix this?

@ScottLiao920
Copy link
Author

Hi I found out that batch_add can only handle tm.VectorUint, hence I converted with

    vectors = [tm.VectorFloat(embedding) for embedding in all_embeds[:100]]

    # Initialize Minhash with desired dimensions
    minhash = tm.Minhash(d=128)

    # Create MinHash signatures from the embeddings
    minhashes = minhash.batch_from_weight_array(vectors)

    # Add the Fingerprints to the LSH Forest and index
    lf.batch_add(minhashes)

Not sure whether I did this correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant