Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 584
Shan Avatar asked Feb 07 '14 18:02

Shan


1 Answers

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.

like image 61
Fred Foo Avatar answered Oct 03 '22 07:10

Fred Foo