diff --git a/pyod/models/iforest.py b/pyod/models/iforest.py index 02259992d..5105b6d9b 100644 --- a/pyod/models/iforest.py +++ b/pyod/models/iforest.py @@ -267,6 +267,27 @@ def max_samples_(self): Decorator for scikit-learn Isolation Forest attributes. """ return self.detector_.max_samples_ + + @property + def estimators_features_(self): + """The indeces of the subset of features used to train the estimators. + Decorator for scikit-learn Isolation Forest attributes. + """ + return self.detector_.estimators_features_ + + @property + def n_features_in_(self): + """The number of features seen during the fit. + Decorator for scikit-learn Isolation Forest attributes. + """ + return self.detector_.n_features_in_ + + @property + def offset_(self): + """Offset used to define the decision function from the raw scores. + Decorator for scikit-learn Isolation Forest attributes. + """ + return self.detector_.offset_ @property def feature_importances_(self): diff --git a/pyod/test/test_iforest.py b/pyod/test/test_iforest.py index 042e937a9..4b80cc532 100644 --- a/pyod/test/test_iforest.py +++ b/pyod/test/test_iforest.py @@ -54,6 +54,13 @@ def test_parameters(self): self.clf.estimators_samples_ is not None) assert (hasattr(self.clf, 'max_samples_') and self.clf.max_samples_ is not None) + assert (hasattr(self.clf, 'estimators_features_') and + self.clf.estimators_features_ is not None) + assert (hasattr(self.clf, 'n_features_in_') and + self.clf.n_features_in_ is not None) + assert (hasattr(self.clf, 'offset_') and + self.clf.offset_ is not None) + def test_train_scores(self): assert_equal(len(self.clf.decision_scores_), self.X_train.shape[0])