Skip to content

Commit

Permalink
Fixed Tuple Index Out of range error and unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Peng committed Dec 27, 2018
1 parent 0fad976 commit f68cfcd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion boruta/boruta_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def _fit(self, X, y):
imp_history_rejected = imp_history[1:, not_selected] * -1

# update rank for not_selected features
if not_selected.shape[0] > 0 and not_selected.shape[1] > 0:
if not_selected.shape[0] > 0:
# calculate ranks in each iteration, then median of ranks across feats
iter_ranks = self._nanrankdata(imp_history_rejected, axis=1)
rank_medians = np.nanmedian(iter_ranks, axis=0)
Expand Down
2 changes: 1 addition & 1 deletion boruta/test/unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_if_boruta_extracts_relevant_features(self):
bt.fit(X, y)

# make sure that only all the relevant features are returned
self.assertItemsEqual(range(5), list(np.where(bt.support_)[0]))
self.assertListEqual(list(range(5)), list(np.where(bt.support_)[0]))


if __name__ == '__main__':
Expand Down

0 comments on commit f68cfcd

Please sign in to comment.