Skip to content

Commit 801cb95

Browse files
committed
Fix streamhash import.
1 parent 407f57e commit 801cb95

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pysad/transform/projection/streamhash_projector.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ class StreamhashProjector(BaseTransformer):
1212

1313
def __init__(self, num_components, density=1 / 3.0):
1414
super().__init__(num_components)
15-
import mmh3
16-
1715
self.keys = np.arange(0, num_components, 1)
1816
self.constant = np.sqrt(1. / density) / np.sqrt(num_components)
1917
self.density = density
@@ -54,6 +52,7 @@ def transform_partial(self, X):
5452
return Y
5553

5654
def _hash_string(self, k, s):
55+
import mmh3
5756
hash_value = int(mmh3.hash(s, signed=False, seed=k)) / (2.0 ** 32 - 1)
5857
s = self.density
5958
if hash_value <= s / 2.0:

0 commit comments

Comments
 (0)