Skip to content

Commit

Permalink
Merge pull request #39 from stat17-hb/master
Browse files Browse the repository at this point in the history
Update skope_rules.py (fix invalid mask indexing for OOB samples)
  • Loading branch information
ngoix committed Oct 23, 2020
2 parents d4e77fe + 532960e commit 8521f16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion skrules/skope_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from sklearn.base import BaseEstimator
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
from sklearn.utils.multiclass import check_classification_targets
from sklearn.utils import indices_to_mask
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.ensemble import BaggingClassifier, BaggingRegressor
from sklearn.tree import _tree
Expand Down Expand Up @@ -333,7 +334,8 @@ def fit(self, X, y, sample_weight=None):
self.estimators_features_):

# Create mask for OOB samples
mask = ~samples
mask = ~indices_to_mask(samples, n_samples)

if sum(mask) == 0:
warn("OOB evaluation not possible: doing it in-bag."
" Performance evaluation is likely to be wrong"
Expand Down

0 comments on commit 8521f16

Please sign in to comment.