From 16e7d40d2e9c8233dc1e395852d58f8dd6472deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crist=C3=B3bal=20=C3=81lvarez?= <55604686+Cristobal314@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:21:12 -0400 Subject: [PATCH] Fix error with numpy version Bug fix for current versions of Numpy that do not directly support int, float and bool so they have been replaced by np.int, np.float and np.bool --- boruta/boruta_py.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/boruta/boruta_py.py b/boruta/boruta_py.py index a248f7b..9d51e34 100644 --- a/boruta/boruta_py.py +++ b/boruta/boruta_py.py @@ -316,12 +316,12 @@ def _fit(self, X, y): # 0 - default state = tentative in original code # 1 - accepted in original code # -1 - rejected in original code - dec_reg = np.zeros(n_feat, dtype=int) + dec_reg = np.zeros(n_feat, dtype=np.int) # counts how many times a given feature was more important than # the best of the shadow features - hit_reg = np.zeros(n_feat, dtype=int) + hit_reg = np.zeros(n_feat, dtype=np.int) # these record the history of the iterations - imp_history = np.zeros(n_feat, dtype=float) + imp_history = np.zeros(n_feat, dtype=np.float) sha_max_history = [] # set n_estimators @@ -393,13 +393,13 @@ def _fit(self, X, y): # basic result variables self.n_features_ = confirmed.shape[0] - self.support_ = np.zeros(n_feat, dtype=bool) + self.support_ = np.zeros(n_feat, dtype=np.bool) self.support_[confirmed] = 1 - self.support_weak_ = np.zeros(n_feat, dtype=bool) + self.support_weak_ = np.zeros(n_feat, dtype=np.bool) self.support_weak_[tentative] = 1 # ranking, confirmed variables are rank 1 - self.ranking_ = np.ones(n_feat, dtype=int) + self.ranking_ = np.ones(n_feat, dtype=np.int) # tentative variables are rank 2 self.ranking_[tentative] = 2 # selected = confirmed and tentative @@ -425,7 +425,7 @@ def _fit(self, X, y): self.ranking_[not_selected] = ranks else: # all are selected, thus we set feature supports to True - self.support_ = np.ones(n_feat, dtype=bool) + self.support_ = np.ones(n_feat, dtype=np.bool) self.importance_history_ = imp_history