-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[enhancement] Add conditional seasonality as a new feature #1067
Conversation
*Indicates whether conditional seasonality is applied or not - Type: boolean
*Mask out all the seasonality features that do not belong to the conditioned seasonality *Ensured conditional seasonality is part of the model's data_params *Integrated check in check_dataframe to rule out false column names for conditional seasonality
Model Benchmark
|
Codecov Report
@@ Coverage Diff @@
## main #1067 +/- ##
==========================================
+ Coverage 89.98% 90.01% +0.02%
==========================================
Files 21 21
Lines 4784 4805 +21
==========================================
+ Hits 4305 4325 +20
- Misses 479 480 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…nditional_seasonality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also add a quick example to the seasonal tutorial (or a new tutorial notebook if that one feels too long already)?
If condition_name is provided, the dataframe passed to `fit` and | ||
`predict` should have a column with the specified condition_name | ||
containing only zeros and ones, deciding when to apply seasonality. | ||
Floats between 0 and 1 can be used to apply seasonality partially. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a (code) example - using quarterly changing weekly seasonality - to the docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
I think we can merge this now.
Please add in a subsequent PR
- docstring example
- tutorial inclusion
- some validation of the values in the condition column (range 0-1)
🔬 Background
NeuralProphet forces a weekly, daily, and yearly seasonality to the data (if activated). Apart from that, we were able to add custom seasonalities to the model. However, both custom and default seasonalities are applied to the entire dataset, without the possibility to specify a condition for a custom seasonality.
🔮 Key changes
condition_name
is a new input parameter form.add_seasonality()
. Using this, the NP model fits and predicts seasonalities according to the condition specified by the user.The condition is specified through a new column that is added to the input
df
. The new column should exclusively contain boolean values.True
, if the condition applies to the row timestamp, andFalse
otherwise. The same column(s) must be added to thefuture
dataframe, if we want to predict into the unknown future.The user workflow follows the example of Facebook Prophet
See
test_custom_seasons()
for an exmaple: on-season and off-season weekly seasonalities for Football. on-season we see a high during the weekends, while during the week there is no game going on. off-season does not show an increase during the weekend.📋 Review Checklist