Why won't the Scikit GradientBoostingClassifier allow me to use least squares regression?

Why could it be that

GradientBoostingClassifier(loss='ls')

failure:

raise ValueError("``n_classes`` must be 1 for regression")
ValueError: ``n_classes`` must be 1 for regression

and does it work fine with loss='deviance'?

I use scikit-learn-0.11 with scipy-0.11.0rc1 on 64-bit Ubuntu. This happened with the classification of the dataset with the binary class "YES" "NO".

+5
source share
1 answer

This is a mistake in GradientBoostingClassifier. It should not expose a least squares loss function for classification. Instead, use the โ€œdeviationโ€ loss function.

Sorry for the inconvenience.

PS: , , , .

+6

All Articles