mlforecast icon indicating copy to clipboard operation
mlforecast copied to clipboard

[MLForecast] Add the possibility to pass custom parameters to the fit function

Open helderPereira22 opened this issue 11 months ago • 5 comments

Description

Enable the ability to pass custom parameters (for instance with kwargs) for the fit function of the model

Use case

For instance, to use the Overfitting detector of the Catboost algorithm (where we pass 'early_stopping_rounds' to the fit function)

helderPereira22 avatar Mar 01 '24 15:03 helderPereira22

Hey @helderPereira22, thanks for using mlforecast. I believe you can achieve that following this guide.

Please let us know if that doesn't work for you.

jmoralez avatar Mar 01 '24 16:03 jmoralez

Hello @jmoralez!

I think it works! But do I lose any of the Nixtla capabilities by doing this?

helderPereira22 avatar Mar 02 '24 11:03 helderPereira22

All we do with the trained models is call predict, so it should work exactly in the same way.

jmoralez avatar Mar 02 '24 16:03 jmoralez

Hello @jmoralez,

For instance, adopting the custom training approach you recommended means I wouldn't have the ability to employ Conformal Prediction for creating prediction intervals. Therefore, it seems I would be sacrificing this feature by not applying the .fit method provided by Nixtla.

Could you take this into account?

helderPereira22 avatar Mar 10 '24 14:03 helderPereira22

The intervals are created by performing cross validation, so if you were to set the early stopping rounds you'd end up with a potentially different number of iterations in each fold. My suggestion is to run it once (maybe with all of your data), check which iteration was the best and then fix that value in the catboost constructor and use the regular MLForecast.fit, that way when computing the intervals each fold will use the same number of iterations.

jmoralez avatar Apr 08 '24 20:04 jmoralez

This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one.

github-actions[bot] avatar May 09 '24 04:05 github-actions[bot]