Jaeger
Jaeger

Reputation: 169

How to see the prediction of each base estimator of adaboost classifier in sklearn ensamble

i can see the prediction using AdaBoostClassifier of ensemble method of sklearn using code like this.

from sklearn.ensemble import AdaBoostClassifier
clf = AdaBoostClassifier(n_estimators=100)
clf.fit(X_train, y_train)
y_pred= clf.predict(X_test)
print y_pred

Now i want to see the prediction of all base estimators(i.e. estimation of all the individual 100 base estimators.) Is it possible in sklearn. How would i do that ?please help me. Thnaks in advance.

Upvotes: 2

Views: 3136

Answers (1)

Nikita Astrakhantsev
Nikita Astrakhantsev

Reputation: 4749

for estimator in clf.estimators_:
    print estimator.predict(X_test)

You can also get weight and classification error for each estimator, see documentation.

Upvotes: 4

Related Questions