Skip to content

Commit

Permalink
⭐ fix to be able to use recent numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
Keisuke Ogaki committed Oct 14, 2023
1 parent ebaceca commit ac2960d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pqkmeans/encoder/pq_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def fit(self, x_train):
self.Ds = int(D / self.M)
assert self.trained_encoder is None, "fit must be called only once"

codewords = numpy.zeros((self.M, self.Ks, self.Ds), dtype=numpy.float)
codewords = numpy.zeros((self.M, self.Ks, self.Ds), dtype=float)
for m in range(self.M):
x_train_sub = x_train[:, m * self.Ds: (m + 1) * self.Ds].astype(numpy.float)
x_train_sub = x_train[:, m * self.Ds: (m + 1) * self.Ds].astype(float)
codewords[m], _ = kmeans2(x_train_sub, self.Ks, iter=self.iteration, minit='points')
self.trained_encoder = TrainedPQEncoder(codewords, self.code_dtype)

Expand Down Expand Up @@ -66,7 +66,7 @@ def decode_multi(self, codes):
assert M == self.M
assert codes.dtype == self.code_dtype

decoded = numpy.empty((N, self.Ds * self.M), dtype=numpy.float)
decoded = numpy.empty((N, self.Ds * self.M), dtype=float)
for m in range(self.M):
decoded[:, m * self.Ds: (m + 1) * self.Ds] = self.codewords[m][codes[:, m], :]
return decoded
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy<1.21
numpy
scikit-learn
pipe<2.0
scipy
Expand Down

0 comments on commit ac2960d

Please sign in to comment.