mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-05-27 22:46:02 +00:00
Minor documentation changes (#2207)
This commit is contained in:
parent
55ced96820
commit
f52fddfcf1
17 changed files with 48085 additions and 174 deletions
|
|
@ -84,18 +84,18 @@ A common setting for forecasting is fitting models that need to be updated as ad
|
|||
# Python
|
||||
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']:
|
||||
|
|
@ -104,7 +104,7 @@ def stan_init(m):
|
|||
res[pname] = m.params[pname][0]
|
||||
return res
|
||||
|
||||
df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/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
|
||||
|
||||
|
|
@ -132,4 +132,3 @@ These github repositories provide examples of building on top of Prophet in ways
|
|||
* [forecastr](https://github.com/garethcull/forecastr): A web app that provides a UI for Prophet.
|
||||
|
||||
* [NeuralProphet](https://github.com/ourownstory/neural_prophet): A Prophet-style model implemented in pytorch, to be more adaptable and extensible.
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ By default Prophet fits additive seasonalities, meaning the effect of the season
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_air_passengers.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_air_passengers.csv')
|
||||
m <- prophet(df)
|
||||
future <- make_future_dataframe(m, 50, freq = 'm')
|
||||
forecast <- predict(m, future)
|
||||
|
|
@ -18,15 +18,15 @@ plot(m, forecast)
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_air_passengers.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_air_passengers.csv')
|
||||
m = Prophet()
|
||||
m.fit(df)
|
||||
future = m.make_future_dataframe(50, freq='MS')
|
||||
forecast = m.predict(future)
|
||||
fig = m.plot(forecast)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
This time series has a clear yearly cycle, but the seasonality in the forecast is too large at the start of the time series and too small at the end. In this time series, the seasonality is not a constant additive factor as assumed by Prophet, rather it grows with the trend. This is multiplicative seasonality.
|
||||
|
|
@ -49,8 +49,8 @@ m.fit(df)
|
|||
forecast = m.predict(future)
|
||||
fig = m.plot(forecast)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
The components figure will now show the seasonality as a percent of the trend:
|
||||
|
|
@ -64,8 +64,8 @@ prophet_plot_components(m, forecast)
|
|||
# Python
|
||||
fig = m.plot_components(forecast)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
With `seasonality_mode='multiplicative'`, holiday effects will also be modeled as multiplicative. Any added seasonalities or extra regressors will by default use whatever `seasonality_mode` is set to, but can be overridden by specifying `mode='additive'` or `mode='multiplicative'` as an argument when adding the seasonality or regressor.
|
||||
|
|
@ -88,4 +88,3 @@ m.add_seasonality('quarterly', period=91.25, fourier_order=8, mode='additive')
|
|||
m.add_regressor('regressor', mode='additive')
|
||||
```
|
||||
Additive and multiplicative extra regressors will show up in separate panels on the components plot. Note, however, that it is pretty unlikely to have a mix of additive and multiplicative seasonalities, so this will generally only be used if there is a reason to expect that to be the case.
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Prophet can make forecasts for time series with sub-daily observations by passin
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_yosemite_temps.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_yosemite_temps.csv')
|
||||
m <- prophet(df, changepoint.prior.scale=0.01)
|
||||
future <- make_future_dataframe(m, periods = 300, freq = 60 * 60)
|
||||
fcst <- predict(m, future)
|
||||
|
|
@ -32,7 +32,7 @@ plot(m, fcst)
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_yosemite_temps.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_yosemite_temps.csv')
|
||||
m = Prophet(changepoint_prior_scale=0.01).fit(df)
|
||||
future = m.make_future_dataframe(periods=300, freq='H')
|
||||
fcst = m.predict(future)
|
||||
|
|
@ -126,7 +126,7 @@ You can use Prophet to fit monthly data. However, the underlying model is contin
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_retail_sales.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_retail_sales.csv')
|
||||
m <- prophet(df, seasonality.mode = 'multiplicative')
|
||||
future <- make_future_dataframe(m, periods = 3652)
|
||||
fcst <- predict(m, future)
|
||||
|
|
@ -134,7 +134,7 @@ plot(m, fcst)
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_retail_sales.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_retail_sales.csv')
|
||||
m = Prophet(seasonality_mode='multiplicative').fit(df)
|
||||
future = m.make_future_dataframe(periods=3652)
|
||||
fcst = m.predict(future)
|
||||
|
|
@ -155,7 +155,7 @@ prophet_plot_components(m, fcst)
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
m = Prophet(seasonality_mode='multiplicative', mcmc_samples=300).fit(df)
|
||||
m = Prophet(seasonality_mode='multiplicative', mcmc_samples=300).fit(df, show_progress=False)
|
||||
fcst = m.predict(future)
|
||||
fig = m.plot_components(fcst)
|
||||
```
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ There are two main ways that outliers can affect Prophet forecasts. Here we make
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_wp_log_R_outliers1.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers1.csv')
|
||||
m <- prophet(df)
|
||||
future <- make_future_dataframe(m, periods = 1096)
|
||||
forecast <- predict(m, future)
|
||||
|
|
@ -18,15 +18,15 @@ plot(m, forecast)
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_wp_log_R_outliers1.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers1.csv')
|
||||
m = Prophet()
|
||||
m.fit(df)
|
||||
future = m.make_future_dataframe(periods=1096)
|
||||
forecast = m.predict(future)
|
||||
fig = m.plot(forecast)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
The trend forecast seems reasonable, but the uncertainty intervals seem way too wide. Prophet is able to handle the outliers in the history, but only by fitting them with trend changes. The uncertainty model then expects future trend changes of similar magnitude.
|
||||
|
|
@ -51,8 +51,8 @@ df.loc[(df['ds'] > '2010-01-01') & (df['ds'] < '2011-01-01'), 'y'] = None
|
|||
model = Prophet().fit(df)
|
||||
fig = model.plot(model.predict(future))
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
In the above example the outliers messed up the uncertainty estimation but did not impact the main forecast `yhat`. This isn't always the case, as in this example with added outliers:
|
||||
|
|
@ -60,7 +60,7 @@ In the above example the outliers messed up the uncertainty estimation but did n
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_wp_log_R_outliers2.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers2.csv')
|
||||
m <- prophet(df)
|
||||
future <- make_future_dataframe(m, periods = 1096)
|
||||
forecast <- predict(m, future)
|
||||
|
|
@ -68,15 +68,15 @@ plot(m, forecast)
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_wp_log_R_outliers2.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers2.csv')
|
||||
m = Prophet()
|
||||
m.fit(df)
|
||||
future = m.make_future_dataframe(periods=1096)
|
||||
forecast = m.predict(future)
|
||||
fig = m.plot(forecast)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
Here a group of extreme outliers in June 2015 mess up the seasonality estimate, so their effect reverberates into the future forever. Again the right approach is to remove them:
|
||||
|
|
@ -97,6 +97,5 @@ df.loc[(df['ds'] > '2015-06-01') & (df['ds'] < '2015-06-30'), 'y'] = None
|
|||
m = Prophet().fit(df)
|
||||
fig = m.plot(m.predict(future))
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ from prophet import Prophet
|
|||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')
|
||||
df.head()
|
||||
```
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ First we read in the data and create the outcome variable. As in the Python API,
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_wp_log_peyton_manning.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')
|
||||
```
|
||||
We call the `prophet` function to fit the model. The first argument is the historical dataframe. Additional arguments control how Prophet fits the data and are described in later pages of this documentation.
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ Prophet allows you to make forecasts using a [logistic growth](https://en.wikipe
|
|||
|
||||
```R
|
||||
# R
|
||||
df <- read.csv('../examples/example_wp_log_R.csv')
|
||||
df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R.csv')
|
||||
```
|
||||
```python
|
||||
# Python
|
||||
df = pd.read_csv('../examples/example_wp_log_R.csv')
|
||||
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R.csv')
|
||||
```
|
||||
We must specify the carrying capacity in a column `cap`. Here we will assume a particular value, but this would usually be set using data or expertise about the market size.
|
||||
|
||||
|
|
@ -74,8 +74,8 @@ future['cap'] = 8.5
|
|||
fcst = m.predict(future)
|
||||
fig = m.plot(fcst)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
The logistic function has an implicit minimum of 0, and will saturate at 0 the same way that it saturates at the capacity. It is possible to also specify a different saturating minimum.
|
||||
|
|
@ -114,9 +114,8 @@ m.fit(df)
|
|||
fcst = m.predict(future)
|
||||
fig = m.plot(fcst)
|
||||
```
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
To use a logistic growth trend with a saturating minimum, a maximum capacity must also be specified.
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ forecast <- predict(m, future)
|
|||
```python
|
||||
# Python
|
||||
m = Prophet(mcmc_samples=300)
|
||||
forecast = m.fit(df).predict(future)
|
||||
forecast = m.fit(df, show_progress=False).predict(future)
|
||||
```
|
||||
This replaces the typical MAP estimation with MCMC sampling, and can take much longer depending on how many observations there are - expect several minutes instead of several seconds. If you do full sampling, then you will see the uncertainty in seasonal components when you plot them:
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import logging\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -268,7 +270,7 @@
|
|||
"metadata": {
|
||||
"celltoolbar": "Edit Metadata",
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -282,9 +284,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@
|
|||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"from matplotlib import pyplot as plt\n",
|
||||
"\n",
|
||||
"import pandas as pd\n",
|
||||
"import logging\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -56,7 +58,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"m = Prophet()\n",
|
||||
"m.fit(df)\n",
|
||||
"future = m.make_future_dataframe(periods=366)\n",
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
"source": [
|
||||
"%%R\n",
|
||||
"library(prophet)\n",
|
||||
"df <- read.csv('../examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"m <- prophet(df)\n",
|
||||
"future <- make_future_dataframe(m, periods=366)"
|
||||
]
|
||||
|
|
@ -755,7 +757,7 @@
|
|||
"metadata": {
|
||||
"celltoolbar": "Edit Metadata",
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -769,9 +771,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,14 +10,16 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"from matplotlib import pyplot as plt\n",
|
||||
"import logging\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"logging.getLogger('numexpr').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -78,7 +80,7 @@
|
|||
],
|
||||
"source": [
|
||||
"%%R -w 10 -h 6 -u in\n",
|
||||
"df <- read.csv('../examples/example_air_passengers.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_air_passengers.csv')\n",
|
||||
"m <- prophet(df)\n",
|
||||
"future <- make_future_dataframe(m, 50, freq = 'm')\n",
|
||||
"forecast <- predict(m, future)\n",
|
||||
|
|
@ -102,7 +104,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_air_passengers.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_air_passengers.csv')\n",
|
||||
"m = Prophet()\n",
|
||||
"m.fit(df)\n",
|
||||
"future = m.make_future_dataframe(50, freq='MS')\n",
|
||||
|
|
@ -276,7 +278,7 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -290,9 +292,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"import logging\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"logging.getLogger('numexpr').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
],
|
||||
"source": [
|
||||
"%%R -w 10 -h 6 -u in\n",
|
||||
"df <- read.csv('../examples/example_yosemite_temps.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_yosemite_temps.csv')\n",
|
||||
"m <- prophet(df, changepoint.prior.scale=0.01)\n",
|
||||
"future <- make_future_dataframe(m, periods = 300, freq = 60 * 60)\n",
|
||||
"fcst <- predict(m, future)\n",
|
||||
|
|
@ -115,7 +117,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_yosemite_temps.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_yosemite_temps.csv')\n",
|
||||
"m = Prophet(changepoint_prior_scale=0.01).fit(df)\n",
|
||||
"future = m.make_future_dataframe(periods=300, freq='H')\n",
|
||||
"fcst = m.predict(future)\n",
|
||||
|
|
@ -329,7 +331,7 @@
|
|||
],
|
||||
"source": [
|
||||
"%%R -w 10 -h 6 -u in\n",
|
||||
"df <- read.csv('../examples/example_retail_sales.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_retail_sales.csv')\n",
|
||||
"m <- prophet(df, seasonality.mode = 'multiplicative')\n",
|
||||
"future <- make_future_dataframe(m, periods = 3652)\n",
|
||||
"fcst <- predict(m, future)\n",
|
||||
|
|
@ -353,7 +355,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_retail_sales.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_retail_sales.csv')\n",
|
||||
"m = Prophet(seasonality_mode='multiplicative').fit(df)\n",
|
||||
"future = m.make_future_dataframe(periods=3652)\n",
|
||||
"fcst = m.predict(future)\n",
|
||||
|
|
@ -530,7 +532,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"m = Prophet(seasonality_mode='multiplicative', mcmc_samples=300).fit(df)\n",
|
||||
"m = Prophet(seasonality_mode='multiplicative', mcmc_samples=300).fit(df, show_progress=False)\n",
|
||||
"fcst = m.predict(future)\n",
|
||||
"fig = m.plot_components(fcst)"
|
||||
]
|
||||
|
|
@ -607,7 +609,7 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -621,9 +623,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"import logging\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"logging.getLogger('numexpr').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -74,7 +76,7 @@
|
|||
],
|
||||
"source": [
|
||||
"%%R -w 10 -h 6 -u in\n",
|
||||
"df <- read.csv('../examples/example_wp_log_R_outliers1.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers1.csv')\n",
|
||||
"m <- prophet(df)\n",
|
||||
"future <- make_future_dataframe(m, periods = 1096)\n",
|
||||
"forecast <- predict(m, future)\n",
|
||||
|
|
@ -98,7 +100,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_wp_log_R_outliers1.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers1.csv')\n",
|
||||
"m = Prophet()\n",
|
||||
"m.fit(df)\n",
|
||||
"future = m.make_future_dataframe(periods=1096)\n",
|
||||
|
|
@ -202,7 +204,7 @@
|
|||
],
|
||||
"source": [
|
||||
"%%R -w 10 -h 6 -u in\n",
|
||||
"df <- read.csv('../examples/example_wp_log_R_outliers2.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers2.csv')\n",
|
||||
"m <- prophet(df)\n",
|
||||
"future <- make_future_dataframe(m, periods = 1096)\n",
|
||||
"forecast <- predict(m, future)\n",
|
||||
|
|
@ -226,7 +228,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_wp_log_R_outliers2.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_R_outliers2.csv')\n",
|
||||
"m = Prophet()\n",
|
||||
"m.fit(df)\n",
|
||||
"future = m.make_future_dataframe(periods=1096)\n",
|
||||
|
|
@ -299,7 +301,7 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -313,9 +315,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -10,11 +10,13 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"import logging\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -59,7 +61,7 @@
|
|||
"outputs": [],
|
||||
"source": [
|
||||
"%%R\n",
|
||||
"df <- read.csv('../examples/example_wp_log_R.csv')"
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -68,7 +70,7 @@
|
|||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_wp_log_R.csv')"
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -294,7 +296,7 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -308,9 +310,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,12 +10,14 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"from matplotlib import pyplot as plt\n",
|
||||
"import pandas as pd\n",
|
||||
"import logging\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"warnings.filterwarnings(\"ignore\")"
|
||||
]
|
||||
},
|
||||
|
|
@ -35,7 +37,7 @@
|
|||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"m = Prophet()\n",
|
||||
"m.fit(df)\n",
|
||||
"future = m.make_future_dataframe(periods=366)"
|
||||
|
|
@ -64,7 +66,7 @@
|
|||
"source": [
|
||||
"%%R\n",
|
||||
"library(prophet)\n",
|
||||
"df <- read.csv('../examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"m <- prophet(df)\n",
|
||||
"future <- make_future_dataframe(m, periods=366)"
|
||||
]
|
||||
|
|
@ -1222,7 +1224,7 @@
|
|||
"metadata": {
|
||||
"celltoolbar": "Edit Metadata",
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -1236,9 +1238,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@
|
|||
"source": [
|
||||
"%load_ext rpy2.ipython\n",
|
||||
"%matplotlib inline\n",
|
||||
"\n",
|
||||
"from prophet import Prophet\n",
|
||||
"import pandas as pd\n",
|
||||
"from matplotlib import pyplot as plt\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"import logging\n",
|
||||
"import warnings\n",
|
||||
"\n",
|
||||
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
|
||||
"logging.getLogger('numexpr').setLevel(logging.ERROR)\n",
|
||||
"import warnings\n",
|
||||
"warnings.filterwarnings(\"ignore\")\n",
|
||||
"df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')"
|
||||
"\n",
|
||||
"df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -47,7 +50,7 @@
|
|||
"source": [
|
||||
"%%R\n",
|
||||
"library(prophet)\n",
|
||||
"df <- read.csv('../examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples/example_wp_log_peyton_manning.csv')\n",
|
||||
"m <- prophet(df)\n",
|
||||
"future <- make_future_dataframe(m, periods=366)\n",
|
||||
"m <- prophet(df)\n",
|
||||
|
|
@ -384,7 +387,7 @@
|
|||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -398,9 +401,9 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.8.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue