From 55e95091ea2a9dfae8c128f4136242e910f19459 Mon Sep 17 00:00:00 2001 From: Martin Hirzel Date: Sat, 16 Mar 2024 21:00:52 -0400 Subject: [PATCH 1/2] Avoiding uses of np.float because that has been removed from the latest numpy. Signed-off-by: Martin Hirzel --- .../inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py b/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py index 08375fc7..bf1b3781 100644 --- a/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py +++ b/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py @@ -213,7 +213,7 @@ 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_) @@ -221,7 +221,7 @@ def init_coef(self, itype, X, y, s): 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', @@ -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_): @@ -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] From 96b1e1f392618a672db744751c6171ca09f415ca Mon Sep 17 00:00:00 2001 From: Martin Hirzel Date: Sun, 17 Mar 2024 08:29:02 -0400 Subject: [PATCH 2/2] Better yet to use float instead of np.float64. --- .../inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py b/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py index bf1b3781..f011f3a3 100644 --- a/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py +++ b/aif360/algorithms/inprocessing/kamfadm-2012ecmlpkdd/fadm/lr/pr.py @@ -213,7 +213,7 @@ 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.float64) + dtype=float) elif itype == 1: # at random self.coef_ = np.random.randn(self.n_sfv_ * self.n_features_) @@ -221,7 +221,7 @@ def init_coef(self, itype, X, y, s): elif itype == 2: # learned by standard LR self.coef_ = np.empty(self.n_sfv_ * self.n_features_, - dtype=np.float64) + dtype=float) coef = self.coef_.reshape(self.n_sfv_, self.n_features_) clr = LogisticRegression(C=self.C, penalty='l2', @@ -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.float64) + dtype=float) coef = self.coef_.reshape(self.n_sfv_, self.n_features_) for i in range(self.n_sfv_): @@ -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.float64) + self.c_s_ = np.array([np.sum(s == si).astype(float) for si in range(self.n_sfv_)]) self.n_features_ = X.shape[1] self.n_samples_ = X.shape[0]