After importing Pycaret I called setup(mydf, 'mytarget')
and run compare_models()
. Then, I wanted to save a model from the comparison list and use it on another dataset. What I did was something like: lr = create_model('lr')
.
However, when I try lr.predict(mynewdfwithouttarget)
I got the size mismatch error:
X has 11 features per sample; expecting 37
Other models in the list also output the same (or a similar) error.
So, what is the way to use the models that were trained inside compare_models()
?
Thank you.
Create model:
lr = create_model('lr')
Predict on test / hold-out Sample:
predict_model(lr);
Finalize Model for Deployment:
final_lr = finalize_model(lr)
Predict on new data:
predictions = predict_model(final_lr, data = mynewdfwithouttarget)