Obtain instance weights from AdaBoostM1 in Weka

376 views Asked by At

AdaBoostM1 is a boosting algorithm implemented in Weka. A key component of this algorithm is the reweighting of "hard to classify" instances after each iteration. I want to obtain the weight of each instance that AdaBoostM1 uses for each classifier it constructs

I have used "Instance.weight()" to obtain instance weights before and after building an AdaBoostM1 model. The weights do not change and are therefore not what I am interested in. The source code for AdaBoostM1 is available and it can be seen that weights are set during the construction of a model (here). Can the instance weights somehow be obtained before AdaBoostM1 builds each new model?

1

There are 1 answers

0
Ramiro On BEST ANSWER

No, Weka's AdaboostM1 does not have such feature. But you could inherit the AdaBoostM1 class, copy the AdaBoostM1#buildClassifierUsingResampling method from the source, and paste it in your subclass and manipulate the double[] weights variable (as seen in line 513).