Skip to content

[BUG] ProphetModel doesn't work with cap and floor regressors #841

Closed
1 task done
julia-shenshina opened this issue Aug 9, 2022 · 0 comments · Fixed by #842
Closed
1 task done

[BUG] ProphetModel doesn't work with cap and floor regressors #841

julia-shenshina opened this issue Aug 9, 2022 · 0 comments · Fixed by #842
Assignees
Labels
bug Something isn't working

Comments

@julia-shenshina
Copy link
Contributor

julia-shenshina commented Aug 9, 2022

🐛 Bug Report

I try to run a ProphetModel with logistic growth and cap and floor in my TSDataset and meet an error.

Notes: cap and floor regressors cause an error with all the growth types

Moreover, there is a test that contains smth about cap and floor (in outdated format) but actually does not check logistic trend.

Expected behavior

Logistic growth works correctly if cap/floor are given in TSDataset.

How To Reproduce

Code

import pandas as pd
from etna.datasets import TSDataset, generate_periodic_df
from etna.models import ProphetModel
from etna.pipeline import Pipeline

df = generate_periodic_df(start_time="2020-01-01", periods=100, period=5)

df_exog = pd.DataFrame({"timestamp": pd.date_range("2020-01-01", periods=150)})
df_exog["segment"] = "segment_0"
df_exog["cap"] = 10
df_exog["floor"] = -10

wide_df = TSDataset.to_dataset(df)
wide_df_exog = TSDataset.to_dataset(df_exog)
ts = TSDataset(wide_df, freq="D", df_exog=wide_df_exog, known_future=["cap", "floor"])

model = ProphetModel(growth="logistic",)
pipeline = Pipeline(model=model, transforms=[], horizon=14)

pipeline.fit(ts)

Error

.../lib/python3.8/site-packages/prophet/forecaster.py:219, in Prophet.validate_column_name(self, name, check_holidays, check_seasonalities, check_regressors)
    216 reserved_names.extend([
    217     'ds', 'y', 'cap', 'floor', 'y_scaled', 'cap_scaled'])
    218 if name in reserved_names:
--> 219     raise ValueError(
    220         'Name {name!r} is reserved.'.format(name=name)
    221     )
    222 if (check_holidays and self.holidays is not None and
    223         name in self.holidays['holiday'].unique()):
    224     raise ValueError(
    225         'Name {name!r} already used for a holiday.'.format(name=name)
    226     )

ValueError: Name 'cap' is reserved.

Environment

No response

Additional context

No response

Checklist

  • Bug appears at the latest library version
@julia-shenshina julia-shenshina added the bug Something isn't working label Aug 9, 2022
@julia-shenshina julia-shenshina moved this to Specification in etna board Aug 9, 2022
@julia-shenshina julia-shenshina moved this from Specification to Todo in etna board Aug 9, 2022
@julia-shenshina julia-shenshina changed the title [BUG] ProphetModel(growth="logistic") doesn't work [BUG] ProphetModel doesn't work with cap and floor regressors Aug 9, 2022
@Mr-Geekman Mr-Geekman self-assigned this Aug 9, 2022
@Mr-Geekman Mr-Geekman moved this from Todo to In Progress in etna board Aug 9, 2022
@Mr-Geekman Mr-Geekman moved this from In Progress to In Review in etna board Aug 9, 2022
Repository owner moved this from In Review to Done in etna board Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants