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
Feature: Add support for logistic growth to Prophet #1419
Feature: Add support for logistic growth to Prophet #1419
Conversation
Codecov ReportBase: 94.09% // Head: 94.02% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #1419 +/- ##
==========================================
- Coverage 94.09% 94.02% -0.07%
==========================================
Files 125 125
Lines 11071 11079 +8
==========================================
Hits 10417 10417
- Misses 654 662 +8
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
Many thanks @DavidKleindienst and I'm really sorry it took us so long to review!
I think it looks really good. I would just prefer if we could specify cap
and floor
in the constructor instead of relying on an extra set_capacity()
method. Let me know your thoughts.
See <https://facebook.github.io/prophet/docs/saturating_forecasts.html> for more information | ||
on logistic forecasts. | ||
|
||
The `cap` and `floor` parameters may be: |
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.
You should add a blank line for the bullet-point list to render correctly in HTML (you can try building & rendering the doc with ./gradlew buildDocs
to check the HTML files directly).
LGTM, thanks @DavidKleindienst ! |
Fixed the linting problem and removed a the previous docstring that accidentally remained there. |
* Add logistic growth to prophet * Add RangeIndex to typehint and docstring * Fix import order * Move cap & floor to __init__ * Update darts/models/forecasting/prophet_model.py * Fix linting & remove duplicat docstring --------- Co-authored-by: David Kleindienst <kleindienst@ximes.com> Co-authored-by: Julien Herzen <julien@unit8.co> Co-authored-by: Julien Herzen <j.herzen@gmail.com>
Fixes #628 and #178
Summary
Adds support for logistic growth to
Prophet
and a corresponding unit-test.This PR adds the function
Prophet.set_capacity
to allow settingcap
andfloor
parameters needed.Prophet.set_capacity
takes two arguments (cap
andfloor
), which may be either numbers or Callables.floor
defaults to 0, to replicateFBProphet's
default behaviour.Numbers should be used as arguments when modeling a constant carrying capacity, Callables can be supplied when variable carrying capacities are needed.
A Callable supplied as argument to
Prophet.set_capacity
must accept aDatetimeIndex
orRangeIndex
as input, and return a Sequence of numbers with the same length. Each number in this Sequence indicates the carrying capacity at the corresponding index.During
Prophet.fit
andProphet.predict
cap and floor columns with the appropriate values are added tofit_df
andpredict_df
, respectively.If
Prophet
was instantiated withgrowth = 'logistic
,Prophet.fit
now raises aValueError
if carrying capacities have not been set.If
Prophet.set_capacity
is called whengrowth
is not logistic, a warning is logged and thecap
andfloor
values set are ignored.