rajatsen91
rajatsen91

Reputation: 222

Bagging Classifier

In a two class classification problem, is there any method to select the number of positive and negative training instances to be chosen while using the standard bagging classifier in Python ?

logreg = BaggingClassifier(linear_model.LogisticRegression(C=1e3),max_samples=1, max_features=1);

Sometimes the Bagging algorithm chooses only positive samples and the code gives a run-time error.

Upvotes: 4

Views: 2375

Answers (1)

Antonio Augusto Viana
Antonio Augusto Viana

Reputation: 21

Looking at the source code (https://github.com/scikit-learn/scikit-learn/blob/51a765a/sklearn/ensemble/bagging.py#L361) there is no way to do it.

But I've noticed that you are using 1 (an integer value) as max_samples and max_features. Using this value you are saying that the Bagging should use just one FEATURE per estimator. If you want it to use ALL features you have to use 1.0.

Maybe this is what is causing you trouble.

Upvotes: 1

Related Questions