Shan
Shan

Reputation: 19293

How to use your own custom classifier with sklearn's adaboost method?

I have my own classifier which is written in python. I want to use that classifier with adaboostclassifier method. One example which has been provided online is in the link.

The key code line is as follows

  clf_2 = AdaBoostRegressor(DecisionTreeRegressor(max_depth=4),
                      n_estimators=300, random_state=rng)

It combines the DecisionTreeRegressor with the boosting.

I am wondering that how could we give the custom made classification method.

Which methods are required to be implemented, data formats etc.

Is there any code which could be followed online? Any code sample which could demonstrate, plugging in your custom classifier.

Upvotes: 6

Views: 11621

Answers (1)

Fred Foo
Fred Foo

Reputation: 363818

The roll-your-own estimator section in the docs explains how to implement your own estimator. In addition to this, you need to implement the sample_weight argument to fit because AdaBoost requires a way of reweighting samples.

Upvotes: 10

Related Questions