Passing kwargs to the underlying fitting function #2438
Labels
good first issue
Good for newcomers
improvement
New feature or improvement
pr_welcome
Open to be worked on
Is your feature request related to a current problem? Please describe.
I wanted to pass some additional arguments to
Prophet
's fit function (from now on called fit_kwargs), but this is not currently supported by darts. The only current possibility for the user to achieve this, is to subclassProphet
and overwrite the._fit
functionIn general, there are multiple different strategies (depending on the model) in darts how passing through of fit_kwargs is currently handled.
Looking through the code, I would summarize the current situation as follows (hope I haven't missed something):
RegressionModels
support passing of fit_kwargs to the.fit
functionTorchForecastingModels
use thepl_trainer_kwargs
argument in the constructorExponentialSmoothing
supports passing of fit_kwargs to the constructor. It also allows passing of constructor_kwargs (that will be passed to the constructor of the underlying model) as a dict.Prophet
andAutoARIMA
do not support passing of fit_kwargs (even though the underlying model has meaningful kwargs)Describe proposed solution
I propose to unify the behavior (except for
TorchForecastingModels
which makes sense be treated differently) to support passing of fit_kwargs through the.fit
function, i.e.:Prophet
andAutoARIMA
ExponentialSmoothing
constructor and fit function signatures to the same style. This would be a breaking change.I think having the argument passing in the
.fit
function rather than the constructor function is better for two reasons:.fit
method would be the more obvious place where users would look for the possibility to pass such kwargs.Describe potential alternatives
Prophet
andAutoARIMA
but keepExponentialSmoothing
as it isfit_kwargs
argument to the constructors ofProphet
andAutoARIMA
and pass those to the fit function.Additional context
I'm happy to prepare a PR for this issue, once it is decided which of these solutions should be implemented
The text was updated successfully, but these errors were encountered: