Comments (6)
I notice you update minhash just once, with a concatenation of all features. This effectively makes each minhash contains just one element in the set.
m[i].update(struct.pack("{}f".format(len(feature)), *feature))
I think you should call update on every feature in a loop to create just one minhash.
Another thing, if your features are all floats, they are considered distinct by minhash even when they are close. e.g. 1.00001 and 1.001 are different in minhash, because they produce different bytes. And two sets {1.0001, 2.0001} and {0.9998, 2.01} are completely different and have a jaccard similarity of 0.
from datasketch.
Thanks! I also noticed my problem. However, after i changed to weighted minhash, the result is still empty.
import numpy as np
from datasketch import WeightedMinHashGenerator
from datasketch import MinHashLSH,MinHashLSHForest
v1 = np.array([1,2,3]).astype('float')
v2 = np.array([2,2,3]).astype('float')
v3 = np.array([1,2.1,3]).astype('float')
mg = WeightedMinHashGenerator(3, 10)
m1 = mg.minhash(v1)
m2 = mg.minhash(v2)
m3 = mg.minhash(v3)
forest = MinHashLSHForest(num_perm=10)
forest.add("m1", m1)
forest.add("m2", m2)
forest.add("m3", m3)
forest.index()
result = forest.query(m1, 3)
print(result)
from datasketch.
I see. There is a bug in handling Weighted MinHash in LSH Forest.
It has been fixed. Thanks.
from datasketch.
@ekzhu Thanks!
from datasketch.
Hi, after I switch from LSH to LSHforest. Although I set the same num_perm for them, I found the results were still quite different. For example, the top-40 I got from LSHforest is totally different from the sorted top 40 I got from LSH (e.g. I got a list of results from one LSH query, and then compute the weighted jaccard similarity between the query item and each of the result. After that i sort the results ordered from most similar to least similar and take the top 40). Could you check the performance for the LSHforest on weighted minhash?
Besides that, if I use MinhashLSH instead, can I control the number of result returned for each query? Because our dataset is very large, the number of result is also very large but we only need the top few similar items. Calculating the distance between the query item and each of the returned result is quite a big cost.
from datasketch.
from datasketch.
Related Issues (20)
- Advice for compression of a big graph HOT 3
- Distributed MinHashLSH HOT 3
- Poor default args in MinHashLSH? HOT 1
- Is is possible to rename already created index? HOT 1
- Add C-minHash variant HOT 11
- Synchronous Mongodb Storage HOT 3
- Merging (Identically Specified) MinHashLSH objects HOT 11
- Impact of MinHashLSH threshold on memory usage HOT 2
- Too large minhashLSH index HOT 10
- Is the bumber of bands correct? HOT 3
- Choice of np.uint64? HOT 11
- def jaccard 's denominator is self not [self union other] . HOT 2
- How to Use MinHash and MinHashLSH to Identify Comprehensive Documents and Partial Matches? HOT 3
- Forever growing index HOT 4
- HNSW: `HNSW.add` will not set the entry point of new levels HOT 2
- Process-safe, no mem bloat, implementation of LSH HOT 1
- Implementing MinHash retrieval from keys for MinHashLSHForest HOT 2
- Cassandra storage not compatible with Python 3.12 HOT 5
- Question: Effects of Bit Truncation on MinhashLSH? HOT 15
- uint64 overflow risk
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 datasketch.