Metadata-Version: 2.1
Name: p-stable-lsh-python
Version: 0.0.1
Summary: A 1&2-stable Locality-Sensitive Hashing implementation in Python
Home-page: https://github.com/CharlesLiu7/p-stable-lsh-python
Author: Charles7
Author-email: liuhuiqi@mail.ustc.edu.cn
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/CharlesLiu7/p-stable-lsh-python/issues
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# P-stable-LSH

The package is one implementation of paper Locality-Sensitive Hashing Scheme Based on p-Stable Distributions in SCG’2014.

## test case

```
data = [np.random.random(100) for _ in range(2)]


m1 = pstable(50, metric_dim=1, num_perm=200000)
m1.lsh(data[0])
m2 = pstable(50, metric_dim=1, num_perm=200000)
m2.lsh(data[1])
print(m1.jaccard(m2)) # estimate value
print(m1.p(np.average(sum(np.abs(data[0]-data[1]))))) # theoretical(true) value

m1 = pstable(50, metric_dim=2, num_perm=200000)
m1.lsh(data[0])
m2 = pstable(50, metric_dim=2, num_perm=200000)
m2.lsh(data[1])
print(m1.jaccard(m2)) # estimate value
print(m1.p(np.sqrt(sum([i**2 for i in data[0]-data[1]])))) # theoretical(true) value
```


