Search code examples
pythonmachine-learningregressionensemble-learning

Why is my stacking regressor scoring worse than its components?


I'm using the following snippet of code: enter image description here

The function test_submodels calculates the r^2 testscore of each submodel and tosses out the bad ones (in this case only the svm model), and returns the new list model_names. Then I'm calculating the r^2 scores of my stacked regressor which turns out the be awful. The output of this code can be seen below: score overview

Here is some more clarification regarding the submodels, they are created as such: enter image description here


Solution

  • I ended up fixing the problem, I had to define the final estimator in the stacking regressor, for example as such: enter image description here

    This improves the stacking score to roughly 0.9