Commit graph

656 commits

Author SHA1 Message Date
Ben Letham
83c4ef3e2b Merge branch 'patch-1' of https://github.com/loulo1/prophet into loulo1-patch-1 2021-04-20 17:49:17 -07:00
Ben Letham
847ecee033 Merge 2021-04-20 17:43:10 -07:00
Ben Letham
e11135e4a4 Add to additional topics docs 2021-04-15 14:58:19 -07:00
loulo1
3a0061e8e1
change init into inits for CmdStanPyBackend 2021-04-14 15:39:02 +02:00
Tyler Kennedy
cd8a24eddd
Fix PyStan Installation Link (#1860)
`installation_beginner.html` no longer exists on RTD.
2021-04-03 18:03:28 -04:00
Vladimir Shargin
899b4fac13
Add include_legend flag to m.plot() (#1858) 2021-04-03 18:01:41 -04:00
Ben Letham
c72ed7abcd Update with notes for latest release 2021-04-02 16:53:06 -07:00
Sean Taylor
1eed11b0f1 Remove organization field from license 2021-03-29 15:36:57 -07:00
Sean Taylor
cb0160e111 Pin shim to fixed version 2021-03-29 15:36:57 -07:00
Ben Letham
3f4edef7f5 Fix R handling of dates to work for tsibble 2021-03-29 15:06:09 -07:00
Sean Taylor
94e5d2e80a Bump version numbers 2021-03-26 15:36:07 -07:00
Sean Taylor
82f3399409 Pin to last 2.* Pystan release. 2021-03-25 22:15:10 -07:00
Ben Letham
360d294dbc
Refresh online docs, change package name in docs (#1852) 2021-03-26 00:03:05 -04:00
Ben Letham
4869ccf943 Skip stan function tests on windows 2021-03-24 08:46:44 -07:00
Ben Letham
6d81543eb2
Pakage rename (#1844)
* Rename package from fbprophet to prophet, and add shim

* Untrack files that should have been ignored

* Update github actions build commands
2021-03-21 14:13:50 -07:00
Cuong Duong
16472a5700
Upgrade CmdStanPy interface (#1849)
* 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>
2021-03-20 10:59:58 -07:00
Cuong Duong
8ffa0e02a6
use builtin int and float (#1850) 2021-03-20 10:50:14 -07:00
loulo1
fc8fa49aac Fix the issue #1814
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
2021-03-09 15:05:57 +01:00
Ben Letham
8882c6a3e3 Use pathlib to load model file (#1835) 2021-03-05 09:55:35 -08:00
Ben Letham
b5e67e59c3 Clean up R check warnings 2021-03-04 20:59:51 -08:00
Ben Letham
49a89d2a4e Bump version in unit test 2021-03-04 20:12:34 -08:00
Ben Letham
b7a583ec63 R manual update 2021-03-04 17:17:51 -08:00
Ben Letham
612934695b Version bump 2021-03-04 17:16:23 -08:00
Ben Letham
a4b31cd70b Refactor R cross validation to match Py function structure 2021-03-04 14:04:48 -08:00
Ben Letham
eb6b8f60ec Enable cross validation on a deserialized model (#1709) 2021-03-03 18:40:27 -08:00
Ben Letham
bbc44bf67c Add test for backwards compatibility with v0.7.1 serialized models 2021-03-03 18:14:16 -08:00
Ben Letham
a1803a8801 Minor rearrange 2021-03-03 18:09:59 -08:00
Ben Letham
74b21f7cd9 Error for unrecognized options in StanBackend.set_options 2021-03-03 18:04:15 -08:00
Ben Letham
4e99ac686e Validate custom cutoffs for data range (R #1650) 2021-03-03 17:59:24 -08:00
Ben Letham
58a0b96550 Plot continuous weekly seasonality in R (#1557, translates #1615 and #1707) 2021-03-03 17:43:58 -08:00
Ben Letham
aaa89445a1 R use GMT for all dates to avoid daylight savings (#1501) 2021-03-03 16:53:39 -08:00
Ben Letham
47ce88f255 Add stepwise trend as example of custom trend to documentation 2021-03-03 16:10:44 -08:00
Ben Letham
f123a1a7cc Fix holidays NA handling 2021-03-03 16:06:25 -08:00
Ben Letham
2e9f831474 Check for NAs in holiday dataframe 2021-03-03 15:43:49 -08:00
Ben Letham
29f14172f0 Handle numpy fit_kwargs when serializing (#1701) 2021-03-03 15:23:12 -08:00
Ben Letham
9e4e87af9b Make sure y_scale is not numpy float (#1824) 2021-03-03 14:52:08 -08:00
Ben Letham
8f1c1d5a27 Fix bug in timezone handling in R (#1501) 2021-03-03 14:35:36 -08:00
Cuong Duong
fae1ac1f9a
add mdape and smape to performance metrics tests (#1804) 2021-03-02 08:30:23 -08:00
Cuong Duong
2d56e71fed
Add regressor_coefficients function for R (#1803)
* 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
2021-03-02 08:30:00 -08:00
Sam Snarr
e95d7c5155
Clean docs (#1798)
* added links and formatting

* update docs via `make notebooks`

* Updated rstan build files (by running R CMD INSTALL .)
2021-03-02 08:06:14 -08:00
Nodar Okroshiashvili
ad2de1e69d
Add Georgian holidays (#1827)
* Update gitignore

* Add Georgian holidays
2021-03-01 17:25:03 -08:00
Leo Liu
2b90e5f6bb
remove a typo in diagnostics.md (#1780)
* add quick start notebook

* remove typo
2021-01-26 17:56:06 -08:00
Sam Snarr
57230997ba
updated readme with 'contributing' info (#1782) 2021-01-14 14:39:35 -08:00
Sam Snarr
3adcf9312d
imports RcppParallel and excludes one function that is already in the namespace by importing Rcpp (#1779) 2021-01-14 14:38:36 -08:00
Sam Snarr
2d8e6c7fd1
Added growth='flat' functionality in R (#1778)
* 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
2021-01-14 13:53:08 -08:00
sim
73b53658e1
used regex to format the name variable for plotting holiday components (#1766)
* 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.
2021-01-08 13:22:56 -08:00
Ben Letham
fdb6b36506 Update gem versions 2021-01-07 13:39:47 -08:00
Ben Letham
8cf0e82598
Update build badge to GH actions 2021-01-07 13:21:35 -08:00
Ben Letham
eed6aa1660
Update build-and-test.yml 2021-01-07 13:18:51 -08:00
Ben Letham
dbf8cc373d
Add github actions CI configuration 2021-01-07 12:13:39 -08:00