Skip to content

Commit

Permalink
Fix streamhash import.
Browse files Browse the repository at this point in the history
  • Loading branch information
selimfirat committed Aug 15, 2020
1 parent 407f57e commit 801cb95
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pysad/transform/projection/streamhash_projector.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class StreamhashProjector(BaseTransformer):

def __init__(self, num_components, density=1 / 3.0):
super().__init__(num_components)
import mmh3

self.keys = np.arange(0, num_components, 1)
self.constant = np.sqrt(1. / density) / np.sqrt(num_components)
self.density = density
Expand Down Expand Up @@ -54,6 +52,7 @@ def transform_partial(self, X):
return Y

def _hash_string(self, k, s):
import mmh3
hash_value = int(mmh3.hash(s, signed=False, seed=k)) / (2.0 ** 32 - 1)
s = self.density
if hash_value <= s / 2.0:
Expand Down

0 comments on commit 801cb95

Please sign in to comment.