3

I am having some difficulties with StackingRegressor. Actully I trained lot of regressors and get good results.

I thougt that I would probably get better result if I use StackingRegressor but I did not. And I think that I am missing something...

Here is my code:

regressors=[rf, knn]
stregr = StackingRegressor(regressors=regressors, meta_regressor=LinearRegression())

Here is what I understand about stacking: if randomforest is better than knn when (for exemple) the obs is a woman and knn is better than randomforest when the obs is a man, stacking will use this information and predict with random forest for women and with knn for men.

Sex is a meta feature that will be use by the Stacking model.

But, in my exemple, how can I define a meta feature list? What meta feature will be used by StackingRegressor if I do not explicitly tell it which one to use? All available variables? None?

I also try a stacking with all my regressors but I get very very bad results!!! Same than above, I think that I need to define some meta feature to use but I do not know how....

regressors=[rf, knn, gb, lasso, ridge, lr, svm_rbf, svm_lin, ada, xgb]
stregr = StackingRegressor(regressors=regressors, meta_regressor=LinearRegression())

If anyone understand how it work or get any link to python notebook or anything to help it would be great.

Thanks in advance!

Anneso
  • 583
  • 2
  • 11
  • 20

0 Answers0