Skip to content

Commit 8521f16

Browse files
authored
Merge pull request #39 from stat17-hb/master
Update skope_rules.py (fix invalid mask indexing for OOB samples)
2 parents d4e77fe + 532960e commit 8521f16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

skrules/skope_rules.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from sklearn.base import BaseEstimator
88
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
99
from sklearn.utils.multiclass import check_classification_targets
10+
from sklearn.utils import indices_to_mask
1011
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
1112
from sklearn.ensemble import BaggingClassifier, BaggingRegressor
1213
from sklearn.tree import _tree
@@ -333,7 +334,8 @@ def fit(self, X, y, sample_weight=None):
333334
self.estimators_features_):
334335

335336
# Create mask for OOB samples
336-
mask = ~samples
337+
mask = ~indices_to_mask(samples, n_samples)
338+
337339
if sum(mask) == 0:
338340
warn("OOB evaluation not possible: doing it in-bag."
339341
" Performance evaluation is likely to be wrong"

0 commit comments

Comments
 (0)