* cmdstan variable extraction update
* add backwards compatibility
* Fix bug
* Upgrade stan version in requirements and in CI testing
Co-authored-by: Ben Letham <bletham@gmail.com>
I did as PyStanBackend. And now when we use the method fit of Prophet, we can do like in the documentation:
https://facebook.github.io/prophet/docs/additional_topics.html#updating-fitted-models
def stan_init(m):
"""Retrieve parameters from a trained model.
Retrieve parameters from a trained model in the format
used to initialize a new Stan model.
Parameters
----------
m: A trained model of the Prophet class.
Returns
-------
A Dictionary containing retrieved parameters of m.
"""
res = {}
for pname in ['k', 'm', 'sigma_obs']:
res[pname] = m.params[pname][0][0]
for pname in ['delta', 'beta']:
res[pname] = m.params[pname][0]
return res
df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')
df1 = df.loc[df['ds'] < '2016-01-19', :] # All data except the last day
m1 = Prophet().fit(df1) # A model fit to all data except the last day
%timeit m2 = Prophet().fit(df) # Adding the last day, fitting from scratch
%timeit m2 = Prophet().fit(df, init=stan_init(m1)) # Adding the last day, warm-starting from m1
Update models.py
Update models.py
Update models.py
Update models.py
Update models.py
Update models.py
Update models.py
Test
Test2
Test4
Test4
Test are fixed
* function code
* add tests for regressor coefficients utility
* add documentation for regressor_coefficients util function
* generate Rd docs
* add regressor_coefficients to R namespace
* minor formatting nit
* fix bugs
* added `flat_growth_init()` function
* added validation for 'flat'
* changed `fit.prophet()` to handle `growth='flat'`
* added `trend='flat'` capabilities to `sample_predictive_trend()` and `fit.prophet()`
* updated STAN code to handle flat trend
* [Syntax fix] Removed unnecessary bracket
* updated documentation
* undid formatting that was accidentally applied by autoformatter
* undid more formatting that was accidentally applied by autoformatter
* added tests
* typo in `sample_predictive_trend()`
* updated notebook with example in R
* updated documentation
* used regex to format the `name`
Removes all singlequotes (') and doublequotes (") in the `name` variable
and replaces all whitespace with an underscore. Now, `ggplot2::aes_string()` can handle a column
name like `New Year's Day`.
* Used backticks in the `name` variable instead of regular expressions
Essentially, I escaped the string `name` with backticks so that
`ggplot2::geom_line()` and `ggplot2::ggplot()` functions can use any
arbitrary input.