Skip to content

Commit 8f46e16

Browse files
committed
changed numpy types
1 parent 47316d3 commit 8f46e16

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
HERE = pathlib.Path(__file__).parent
55

6-
VERSION = '0.2.6'
6+
VERSION = '0.2.7'
77
PACKAGE_NAME = 'shap-hypetune'
88
AUTHOR = 'Marco Cerliani'
99
AUTHOR_EMAIL = '[email protected]'

shaphypetune/_classes.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,13 @@ def fit(self, X, y, **fit_params):
518518

519519
# holds the decision about each feature:
520520
# default (0); accepted (1); rejected (-1)
521-
dec_reg = np.zeros(n_features, dtype=np.int)
522-
dec_history = np.zeros((self.max_iter, n_features), dtype=np.int)
521+
dec_reg = np.zeros(n_features, dtype=int)
522+
dec_history = np.zeros((self.max_iter, n_features), dtype=int)
523523
# counts how many times a given feature was more important than
524524
# the best of the shadow features
525-
hit_reg = np.zeros(n_features, dtype=np.int)
525+
hit_reg = np.zeros(n_features, dtype=int)
526526
# record the history of the iterations
527-
imp_history = np.zeros(n_features, dtype=np.float)
527+
imp_history = np.zeros(n_features, dtype=float)
528528
sha_max_history = []
529529

530530
for i in range(self.max_iter):
@@ -587,8 +587,8 @@ def fit(self, X, y, **fit_params):
587587
confirmed = np.where(dec_reg == 1)[0]
588588
tentative = np.where(dec_reg == 0)[0]
589589

590-
self.support_ = np.zeros(n_features, dtype=np.bool)
591-
self.ranking_ = np.ones(n_features, dtype=np.int) * 4
590+
self.support_ = np.zeros(n_features, dtype=bool)
591+
self.ranking_ = np.ones(n_features, dtype=int) * 4
592592
self.n_features_ = confirmed.shape[0]
593593
self.importance_history_ = imp_history[1:]
594594

@@ -733,8 +733,8 @@ def fit(self, X, y, **fit_params):
733733
if step <= 0:
734734
raise ValueError("Step must be >0.")
735735

736-
self.support_ = np.ones(n_features, dtype=np.bool)
737-
self.ranking_ = np.ones(n_features, dtype=np.int)
736+
self.support_ = np.ones(n_features, dtype=bool)
737+
self.ranking_ = np.ones(n_features, dtype=int)
738738
if scoring:
739739
self.score_history_ = []
740740
eval_score = np.max if self.greater_is_better else np.min
@@ -918,10 +918,10 @@ def fit(self, X, y, **fit_params):
918918
if step <= 0:
919919
raise ValueError("Step must be >0.")
920920

921-
self.support_ = np.zeros(n_features, dtype=np.bool)
922-
self._support = np.ones(n_features, dtype=np.bool)
923-
self.ranking_ = np.ones(n_features, dtype=np.int)
924-
self._ranking = np.ones(n_features, dtype=np.int)
921+
self.support_ = np.zeros(n_features, dtype=bool)
922+
self._support = np.ones(n_features, dtype=bool)
923+
self.ranking_ = np.ones(n_features, dtype=int)
924+
self._ranking = np.ones(n_features, dtype=int)
925925
if scoring:
926926
self.score_history_ = []
927927
eval_score = np.max if self.greater_is_better else np.min
@@ -992,8 +992,8 @@ def fit(self, X, y, **fit_params):
992992
self.estimator_ = best_estimator
993993

994994
if len(set(self.score_history_)) == 1:
995-
self.support_ = np.ones(n_features, dtype=np.bool)
996-
self.ranking_ = np.ones(n_features, dtype=np.int)
995+
self.support_ = np.ones(n_features, dtype=bool)
996+
self.ranking_ = np.ones(n_features, dtype=int)
997997
self.estimator_ = all_features_estimator
998998
self.n_features_ = self.support_.sum()
999999

shaphypetune/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _feature_importances(model):
6565
def _get_categorical_support(n_features, fit_params):
6666
"""Obtain boolean mask for categorical features"""
6767

68-
cat_support = np.zeros(n_features, dtype=np.bool)
68+
cat_support = np.zeros(n_features, dtype=bool)
6969
cat_ids = []
7070

7171
msg = "When manually setting categarical features, " \

0 commit comments

Comments
 (0)