Skip to content

Commit

Permalink
Avoiding uses of np.float because that has been removed from the late…
Browse files Browse the repository at this point in the history
…st numpy.

Signed-off-by: Martin Hirzel <[email protected]>
  • Loading branch information
Martin Hirzel committed Mar 17, 2024
1 parent a4d18f2 commit 55e9509
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ def init_coef(self, itype, X, y, s):
if itype == 0:
# clear by zeros
self.coef_ = np.zeros(self.n_sfv_ * self.n_features_,
dtype=np.float)
dtype=np.float64)
elif itype == 1:
# at random
self.coef_ = np.random.randn(self.n_sfv_ * self.n_features_)

elif itype == 2:
# learned by standard LR
self.coef_ = np.empty(self.n_sfv_ * self.n_features_,
dtype=np.float)
dtype=np.float64)
coef = self.coef_.reshape(self.n_sfv_, self.n_features_)

clr = LogisticRegression(C=self.C, penalty='l2',
Expand All @@ -232,7 +232,7 @@ def init_coef(self, itype, X, y, s):
elif itype == 3:
# learned by standard LR
self.coef_ = np.empty(self.n_sfv_ * self.n_features_,
dtype=np.float)
dtype=np.float64)
coef = self.coef_.reshape(self.n_sfv_, self.n_features_)

for i in range(self.n_sfv_):
Expand Down Expand Up @@ -276,7 +276,7 @@ def fit(self, X, y, ns=N_S, itype=0, **kwargs):
# set instance variables
self.n_s_ = ns
self.n_sfv_ = np.max(s) + 1
self.c_s_ = np.array([np.sum(s == si).astype(np.float)
self.c_s_ = np.array([np.sum(s == si).astype(np.float64)
for si in range(self.n_sfv_)])
self.n_features_ = X.shape[1]
self.n_samples_ = X.shape[0]
Expand Down

0 comments on commit 55e9509

Please sign in to comment.