Nixtla / mlforecast

Scalable machine 🤖 learning for time series forecasting.
https://nixtlaverse.nixtla.io/mlforecast
Apache License 2.0
789 stars 74 forks source link

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

Closed helderPereira22 closed 2 months ago

helderPereira22 commented 4 months ago

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)

jmoralez commented 4 months ago

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.

helderPereira22 commented 4 months ago

Hello @jmoralez!

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

jmoralez commented 4 months ago

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

helderPereira22 commented 4 months ago

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?

jmoralez commented 3 months ago

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.

github-actions[bot] commented 2 months ago

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.