Skip to content

Commit

Permalink
Fix AttributeError issue when verbose > 1 in StackingClassifier
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Jul 21, 2016
1 parent 31e75d2 commit a22f3d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/sources/CHANGELOG.md
Expand Up @@ -25,6 +25,7 @@ imput arrays via `transform` and `fit_transform`
- More rigorous type and shape checks in `evaluate.plot_decision_regions`
- Changes in `DenseTransformer` so that it doesn't fail if the input array is not sparse
- Use scikit-learn's `BaseEstimator` as parent class for `feature_selection.ColumnSelector`
- Fix `AttributeError` issue when `verbose` > 1 in `StackingClassifier`

### Version 0.4.1 (2016-05-01)

Expand Down
2 changes: 1 addition & 1 deletion mlxtend/classifier/stacking_classification.py
Expand Up @@ -93,7 +93,7 @@ def fit(self, X, y):
if self.verbose > 0:
i = self.clfs_.index(clf) + 1
print("Fitting classifier%d: %s (%d/%d)" %
(i, _name_estimators((clf,))[0][0], i, len(self.clf_)))
(i, _name_estimators((clf,))[0][0], i, len(self.clfs_)))

if self.verbose > 2:
if hasattr(clf, 'verbose'):
Expand Down
12 changes: 12 additions & 0 deletions mlxtend/classifier/tests/test_stacking_classifier.py
Expand Up @@ -131,3 +131,15 @@ def test_not_fitted():
" before using this method.",
sclf.predict_proba,
iris.data)


def test_verbose():
np.random.seed(123)
meta = LogisticRegression()
clf1 = RandomForestClassifier()
clf2 = GaussianNB()
sclf = StackingClassifier(classifiers=[clf1, clf2],
use_probas=True,
meta_classifier=meta,
verbose=3)
sclf.fit(iris.data, iris.target)

0 comments on commit a22f3d5

Please sign in to comment.