-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b29f2cf
commit beffdb5
Showing
3 changed files
with
87 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import numpy as np | ||
from pyLSHash import min_hash | ||
|
||
n = 10 # 原向量的维度 | ||
x = np.random.randint(0, 2, n) | ||
k = 3 # minHash 值的维度 | ||
|
||
min_hash_val = min_hash.get_min_hash(x, n, k=4) | ||
print(min_hash_val) | ||
x1 = [1, 1, 0, 0, 0, 1, 1, 1, 1, 0] | ||
x2 = [1, 0, 0, 0, 0, 1, 1, 1, 1, 0] | ||
|
||
n = len(x1) # 向量的维度 | ||
min_hash_val1 = min_hash.get_min_hash(x1, n, k) | ||
min_hash_val2 = min_hash.get_min_hash(x2, n, k) | ||
print(min_hash_val1) | ||
print(min_hash_val2) | ||
assert min_hash_val1 == min_hash_val2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters