I am working on pycaret tool for automated regression.
So, I get the top3 models using compare_models
and blend them as shown below
top3 = compare_models(n_select = 3)
blender = blend_models(top3)
But I would like to blend or stack the tuned models (with best hyparparameters)
So, I tried the below
tuned_knn2 = tune_model(knear,optimize='mae',n_iter = 100)
tuned_rf2 = tune_model(rf2,optimize='mae',n_iter = 100)
tuned_ex2 = tune_model(ex2,optimize='mae',n_iter = 100)
How can I stack/blend the tuned above models using blend_models
or stack_models
?
You can pass these models as a list to the blend_models()
and stack_models()
functions:
blender = blend_models([tuned_knn2, tuned_rf2, tuned_ex2])
Or you could take the top 3 models, in a more automated pycaret approach, and tune the models in a list comprehension:
top3 = compare_models(n_select = 3)
tuned_top3 = [tune_model(i, optimize= 'MAE', n_iter = 100) for i in top3]
blender = blend_models(tuned_top3)