Skip to content

Commit

Permalink
fix test for nightly build python
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzhu committed Mar 18, 2016
1 parent 71b971c commit ad1297e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions datasketch/minhash.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, num_perm=128, seed=1, hashobj=sha1,
if hashvalues is not None:
self.hashvalues = hashvalues
else:
self.hashvalues = np.array([_max_hash for _ in range(num_perm)])
self.hashvalues = np.array([_max_hash for _ in range(num_perm)], dtype=np.int)
# Initalize permutation function parameters
if permutations is not None:
self.permutations = permutations
Expand Down Expand Up @@ -88,7 +88,7 @@ def clear(self):
'''
Clear the current state of the Minhash.
'''
self.hashvalues = np.array([_max_hash for _ in range(num_perm)])
self.hashvalues = np.array([_max_hash for _ in range(num_perm)], dtype=np.int)

def copy(self):
'''
Expand Down
2 changes: 1 addition & 1 deletion datasketch/weighted_minhash.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def minhash(self, v):
raise ValueError("Input dimension mismatch, expecting %d" % self.dim)
if not isinstance(v, np.ndarray):
v = np.array(v)
hashvalues = np.zeros((self.sample_size, 2))
hashvalues = np.zeros((self.sample_size, 2), dtype=np.int)
for i in range(self.sample_size):
t = np.floor((np.log(v) / self.rs[i]) + self.betas[i])
ln_y = (t - self.betas[i]) * self.rs[i]
Expand Down
1 change: 1 addition & 0 deletions test/weighted_minhash_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_minhash(self):
self.assertIsInstance(m, WeightedMinHash)
self.assertEqual(len(m.hashvalues), 4)
self.assertEqual(len(m), 4)
self.assertTrue(m.hashvalues.dtype == np.int)

if __name__ == "__main__":
unittest.main()

0 comments on commit ad1297e

Please sign in to comment.