Skip to content

Commit 47316d3

Browse files
committed
Release
1 parent 1423d2e commit 47316d3

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
HERE = pathlib.Path(__file__).parent
55

6-
VERSION = '0.2.5'
6+
VERSION = '0.2.6'
77
PACKAGE_NAME = 'shap-hypetune'
88
AUTHOR = 'Marco Cerliani'
99
AUTHOR_EMAIL = '[email protected]'

shaphypetune/_classes.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from sklearn.base import clone
99
from sklearn.utils.validation import check_is_fitted
1010
from sklearn.base import BaseEstimator, TransformerMixin
11-
from sklearn.utils.metaestimators import if_delegate_has_method
1211

1312
from joblib import Parallel, delayed
1413
from hyperopt import fmin, tpe
@@ -241,7 +240,6 @@ def predict(self, X, **predict_params):
241240

242241
return self.estimator_.predict(X, **predict_params)
243242

244-
@if_delegate_has_method(delegate='estimator')
245243
def predict_proba(self, X, **predict_params):
246244
"""Predict X probabilities.
247245
@@ -260,6 +258,9 @@ def predict_proba(self, X, **predict_params):
260258

261259
check_is_fitted(self)
262260

261+
# raise original AttributeError
262+
getattr(self.estimator_, 'predict_proba')
263+
263264
if hasattr(self, 'transform'):
264265
X = self.transform(X)
265266

@@ -335,6 +336,31 @@ def transform(self, X):
335336
else:
336337
raise ValueError("Data type not understood.")
337338

339+
def get_support(self, indices=False):
340+
"""Get a mask, or integer index, of the features selected.
341+
342+
Parameters
343+
----------
344+
indices : bool, default=False
345+
If True, the return value will be an array of integers, rather
346+
than a boolean mask.
347+
348+
Returns
349+
-------
350+
support : array
351+
An index that selects the retained features from a feature vector.
352+
If `indices` is False, this is a boolean array of shape
353+
[# input features], in which an element is True iff its
354+
corresponding feature is selected for retention. If `indices` is
355+
True, this is an integer array of shape [# output features] whose
356+
values are indices into the input feature vector.
357+
"""
358+
359+
check_is_fitted(self)
360+
361+
mask = self.support_
362+
return mask if not indices else np.where(mask)[0]
363+
338364

339365
class _Boruta(_BoostSelector):
340366
"""Base class for BoostBoruta meta-estimator.

0 commit comments

Comments
 (0)