darts icon indicating copy to clipboard operation
darts copied to clipboard

add_seasonality does not expose the condition_name parameter for the prophet model

Open dagap opened this issue 2 years ago • 2 comments

Is your feature request related to a current problem? Please describe. The FB prophet add_seasonality method has a condition_name input variable that is not exposed by darts. This severely limits how custom seasonalities can be added.

Describe proposed solution The add_seasonality method in Prophet class should also take the condition_name as a parameter.

Additionally, the current method which adds the serasonality also ignores the prior_scale and mode parameters.


# prophet_model.py
for seasonality_name, attributes in self._add_seasonalities.items():
            self.model.add_seasonality(
                name=seasonality_name,
                period=attributes["seasonal_periods"] * interval_length,
                fourier_order=attributes["fourier_order"],
            )
# does not pass the mode, prior_scale and the condition_name parameters

dagap avatar Jun 29 '22 07:06 dagap

Thanks for this suggestion. Would you be willing to make a contribution in this direction?

hrzn avatar Jul 04 '22 08:07 hrzn

More than happy! However, there are a few things that would need to change, and perhaps if you could suggest a direction. So another thing in the code that is an issue is:

fit_df = pd.DataFrame(
            data={"ds": series.time_index, "y": series.univariate_values()}
        )

Do you think we should add these extra columns as covariates? The reason I am hesitating is that some of these condition columns are not necessarily covariates.

Currently, I am hacking it as:

training_df = series.pd_dataframe(copy=False)
data_df = {"ds": training_df.index}

for col in training_df.columns.values:
    data_df[col] = training_df[col].values

but perhaps this is not ideal? The predict bits would also need to change to allow creating the correct df.

dagap avatar Jul 04 '22 08:07 dagap