Skip to content

Commit 9f10469

Browse files
authored
Update skope_rules.py
applying ngoix's comment #39
1 parent 36f1afb commit 9f10469

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

skrules/skope_rules.py

Lines changed: 2 additions & 2 deletions
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.externals import six
@@ -335,8 +336,7 @@ def fit(self, X, y, sample_weight=None):
335336

336337
# Create mask for OOB samples
337338
# mask = ~samples # samples is numpy array. when you put ~. it returns array([-(value_1 + 1), ..., -(value_n + 1)])
338-
mask = list(set(np.arange(len(samples))).difference(samples))
339-
339+
mask = ~indices_to_mask(samples, n_samples)
340340

341341
if sum(mask) == 0:
342342
warn("OOB evaluation not possible: doing it in-bag."

0 commit comments

Comments
 (0)