Ver código fonte

Regenerate all documentation

bl 7 anos atrás
pai
commit
1d8f5f906b
62 arquivos alterados com 937 adições e 607 exclusões
  1. 2 1
      docs/_data/nav_docs.yml
  2. 1 1
      docs/_docs/contributing.md
  3. 96 0
      docs/_docs/diagnostics.md
  4. 44 4
      docs/_docs/non-daily_data.md
  5. 27 23
      docs/_docs/quick_start.md
  6. 40 7
      docs/_docs/forecasting_growth.md
  7. 367 0
      docs/_docs/seasonality_and_holiday_effects.md
  8. 1 1
      docs/_docs/trend_changepoints.md
  9. 4 2
      docs/_docs/uncertainty_intervals.md
  10. BIN
      docs/static/diagnostics_files/diagnostics_3_0.png
  11. BIN
      docs/static/forecasting_growth_files/forecasting_growth_12_0.png
  12. BIN
      docs/static/forecasting_growth_files/forecasting_growth_13_0.png
  13. BIN
      docs/static/non-daily_data_files/non-daily_data_10_0.png
  14. BIN
      docs/static/non-daily_data_files/non-daily_data_12_0.png
  15. BIN
      docs/static/non-daily_data_files/non-daily_data_13_0.png
  16. BIN
      docs/static/non-daily_data_files/non-daily_data_3_1.png
  17. BIN
      docs/static/non-daily_data_files/non-daily_data_4_0.png
  18. BIN
      docs/static/non-daily_data_files/non-daily_data_6_0.png
  19. BIN
      docs/static/non-daily_data_files/non-daily_data_7_0.png
  20. BIN
      docs/static/non-daily_data_files/non-daily_data_9_1.png
  21. BIN
      docs/static/outliers_files/outliers_10_0.png
  22. BIN
      docs/static/outliers_files/outliers_12_1.png
  23. BIN
      docs/static/outliers_files/outliers_13_0.png
  24. BIN
      docs/static/outliers_files/outliers_3_1.png
  25. BIN
      docs/static/outliers_files/outliers_4_0.png
  26. BIN
      docs/static/outliers_files/outliers_6_1.png
  27. BIN
      docs/static/outliers_files/outliers_7_0.png
  28. BIN
      docs/static/outliers_files/outliers_9_1.png
  29. BIN
      docs/static/quick_start_files/quick_start_12_0.png
  30. BIN
      docs/static/quick_start_files/quick_start_14_0.png
  31. BIN
      docs/static/quick_start_files/quick_start_26_0.png
  32. BIN
      docs/static/quick_start_files/quick_start_27_0.png
  33. BIN
      docs/static/quick_start_files/quick_start_28_0.png
  34. BIN
      docs/static/quick_start_files/quick_start_29_0.png
  35. BIN
      docs/static/saturating_forecasts_files/saturating_forecasts_12_1.png
  36. BIN
      docs/static/saturating_forecasts_files/saturating_forecasts_13_0.png
  37. BIN
      docs/static/saturating_forecasts_files/saturating_forecasts_15_1.png
  38. BIN
      docs/static/saturating_forecasts_files/saturating_forecasts_16_0.png
  39. BIN
      docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_15_0.png
  40. BIN
      docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_16_0.png
  41. BIN
      docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_25_1.png
  42. BIN
      docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_26_0.png
  43. BIN
      docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_3_1.png
  44. BIN
      docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_4_0.png
  45. BIN
      docs/static/trend_changepoints_files/trend_changepoints_10_0.png
  46. BIN
      docs/static/trend_changepoints_files/trend_changepoints_12_1.png
  47. BIN
      docs/static/trend_changepoints_files/trend_changepoints_13_0.png
  48. BIN
      docs/static/trend_changepoints_files/trend_changepoints_16_1.png
  49. BIN
      docs/static/trend_changepoints_files/trend_changepoints_17_0.png
  50. BIN
      docs/static/trend_changepoints_files/trend_changepoints_4_0.png
  51. BIN
      docs/static/trend_changepoints_files/trend_changepoints_6_0.png
  52. BIN
      docs/static/trend_changepoints_files/trend_changepoints_9_1.png
  53. BIN
      docs/static/uncertainty_intervals_files/uncertainty_intervals_10_0.png
  54. BIN
      docs/static/uncertainty_intervals_files/uncertainty_intervals_9_0.png
  55. 7 3
      notebooks/diagnostics.ipynb
  56. 4 2
      notebooks/non-daily_data.ipynb
  57. 31 93
      notebooks/outliers.ipynb
  58. 45 75
      notebooks/quick_start.ipynb
  59. 59 51
      notebooks/saturating_forecasts.ipynb
  60. 85 150
      notebooks/seasonality_and_holiday_effects.ipynb
  61. 20 52
      notebooks/trend_changepoints.ipynb
  62. 104 142
      notebooks/uncertainty_intervals.ipynb

+ 2 - 1
docs/_data/nav_docs.yml

@@ -2,12 +2,13 @@
   items:
   - id: installation
   - id: quick_start
-  - id: forecasting_growth
+  - id: saturating_forecasts
   - id: trend_changepoints
   - id: seasonality_and_holiday_effects
   - id: uncertainty_intervals
   - id: outliers
   - id: non-daily_data
+  - id: diagnostics
   - id: contributing
 
 # n title:, 1 items: per title:, n id: per items:

+ 1 - 1
docs/_docs/contributing.md

@@ -5,7 +5,7 @@ title: "How to Contribute"
 permalink: /docs/contributing.html
 ---
 
-Prophet has an non-fixed release cycle but we will be making bugfixes in response to user feedback and adding features.  Its current state is Beta (v0.1), we expect no obvious bugs. Please let us know if you encounter a bug by [filing an issue](https://github.com/facebookincubator/prophet/issues).
+Prophet has an non-fixed release cycle but we will be making bugfixes in response to user feedback and adding features.  Its current state is Beta (v0.2), we expect no obvious bugs. Please let us know if you encounter a bug by [filing an issue](https://github.com/facebookincubator/prophet/issues).
 
 We appreciate all contributions. If you are planning to contribute back bug-fixes, please do so without any further discussion.
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 96 - 0
docs/_docs/diagnostics.md


+ 44 - 4
docs/_docs/non-daily_data.md

@@ -4,7 +4,47 @@ docid: "non-daily_data"
 title: "Non-Daily Data"
 permalink: /docs/non-daily_data.html
 ---
-Prophet doesn't strictly require daily data, but you can get strange results if you ask for daily forecasts from non-daily data and fit seasonalities. Here we forecast US retail sales volume for the next 10 years:
+## Sub-daily data
+
+Prophet can make forecasts for time series with sub-daily observations by passing in a dataframe with timestamps in the `ds` column. When sub-daily data are used, daily seasonality will automatically be fit. Here we fit Prophet to data with 5-minute resolution (daily temperatures at Yosemite):
+
+```R
+# R
+df <- read.csv('../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)
+plot(m, fcst);
+```
+```python
+# Python
+df = pd.read_csv('../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)
+m.plot(fcst);
+```
+ 
+![png](/prophet/static/non-daily_data_files/non-daily_data_4_0.png) 
+
+
+The daily seasonality will show up in the components plot:
+
+```R
+# R
+prophet_plot_components(m, fcst)
+```
+```python
+# Python
+m.plot_components(fcst);
+```
+ 
+![png](/prophet/static/non-daily_data_files/non-daily_data_7_0.png) 
+
+
+## Monthly data
+
+You can use Prophet to fit monthly data. However, the underlying model is continuous-time, which means that you can get strange results if you fit the model to monthly data and then ask for daily forecasts. Here we forecast US retail sales volume for the next 10 years:
 
 ```R
 # R
@@ -23,14 +63,14 @@ fcst = m.predict(future)
 m.plot(fcst);
 ```
  
-![png](/prophet/static/non-daily_data_files/non-daily_data_4_0.png) 
+![png](/prophet/static/non-daily_data_files/non-daily_data_10_0.png) 
 
 
 The forecast here seems very noisy. What's happening is that this particular data set only provides monthly data. When we fit the yearly seasonality, it only has data for the first of each month and the seasonality components for the remaining days are unidentifiable and overfit. When you are fitting Prophet to monthly data, only make monthly forecasts, which can be done by passing the frequency into make_future_dataframe:
 
 ```R
 # R
-future <- make_future_dataframe(m, periods = 120, freq = 'm')
+future <- make_future_dataframe(m, periods = 120, freq = 'month')
 fcst <- predict(m, future)
 plot(m, fcst)
 ```
@@ -41,5 +81,5 @@ fcst = m.predict(future)
 m.plot(fcst);
 ```
  
-![png](/prophet/static/non-daily_data_files/non-daily_data_7_0.png) 
+![png](/prophet/static/non-daily_data_files/non-daily_data_13_0.png) 
 

+ 27 - 23
docs/_docs/quick_start.md

@@ -147,37 +147,37 @@ forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
     <tr>
       <th>3265</th>
       <td>2017-01-15</td>
-      <td>8.205065</td>
-      <td>7.488507</td>
-      <td>8.887731</td>
+      <td>8.206753</td>
+      <td>7.485107</td>
+      <td>8.920149</td>
     </tr>
     <tr>
       <th>3266</th>
       <td>2017-01-16</td>
-      <td>8.530088</td>
-      <td>7.862778</td>
-      <td>9.223688</td>
+      <td>8.531766</td>
+      <td>7.779331</td>
+      <td>9.284859</td>
     </tr>
     <tr>
       <th>3267</th>
       <td>2017-01-17</td>
-      <td>8.317468</td>
-      <td>7.644606</td>
-      <td>9.021893</td>
+      <td>8.319156</td>
+      <td>7.610545</td>
+      <td>8.986889</td>
     </tr>
     <tr>
       <th>3268</th>
       <td>2017-01-18</td>
-      <td>8.150081</td>
-      <td>7.462394</td>
-      <td>8.889095</td>
+      <td>8.151772</td>
+      <td>7.415802</td>
+      <td>8.875191</td>
     </tr>
     <tr>
       <th>3269</th>
       <td>2017-01-19</td>
-      <td>8.162015</td>
-      <td>7.438503</td>
-      <td>8.877361</td>
+      <td>8.163690</td>
+      <td>7.427153</td>
+      <td>8.884826</td>
     </tr>
   </tbody>
 </table>
@@ -205,6 +205,8 @@ m.plot_components(forecast);
 ![png](/prophet/static/quick_start_files/quick_start_14_0.png) 
 
 
+More details about the options available for each method are available in the docstrings, for example, via `help(Prophet)` or `help(Prophet.fit)`.
+
 ## R API
 
 In R, we use the normal model fitting API.  We provide a `prophet` function that performs fitting and returns a model object.  You can then call `predict` and `plot` on this model object.
@@ -254,12 +256,12 @@ tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
 ```
 
                  ds     yhat yhat_lower yhat_upper
-    3265 2017-01-14 7.832396   7.140713   8.533132
-    3266 2017-01-15 8.214232   7.460897   8.918678
-    3267 2017-01-16 8.539239   7.788240   9.262142
-    3268 2017-01-17 8.326654   7.615613   9.003147
-    3269 2017-01-18 8.159337   7.382162   8.889958
-    3270 2017-01-19 8.171276   7.354854   8.922918
+    3265 2017-01-14 7.825609   7.183818   8.488012
+    3266 2017-01-15 8.207400   7.478778   8.951113
+    3267 2017-01-16 8.532394   7.826360   9.240482
+    3268 2017-01-17 8.319785   7.596815   9.042505
+    3269 2017-01-18 8.152424   7.440858   8.874581
+    3270 2017-01-19 8.164327   7.419148   8.882906
 
 
 
@@ -270,7 +272,7 @@ You can use the generic `plot` function to plot the forecast, by passing in the
 plot(m, forecast)
 ```
  
-![png](/prophet/static/quick_start_files/quick_start_26_0.png) 
+![png](/prophet/static/quick_start_files/quick_start_27_0.png) 
 
 
 You can use the `prophet_plot_components` function to see the forecast broken down into trend, weekly seasonality, and yearly seasonality.
@@ -280,5 +282,7 @@ You can use the `prophet_plot_components` function to see the forecast broken do
 prophet_plot_components(m, forecast)
 ```
  
-![png](/prophet/static/quick_start_files/quick_start_28_0.png) 
+![png](/prophet/static/quick_start_files/quick_start_29_0.png) 
+
 
+More details about the options available for each method are available in the docstrings, for example, via `?prophet` or `?fit.prophet`. This documentation is also available in the [reference manual](https://cran.r-project.org/web/packages/prophet/prophet.pdf) on CRAN.

+ 40 - 7
docs/_docs/forecasting_growth.md

@@ -1,9 +1,11 @@
 ---
 layout: docs
-docid: "forecasting_growth"
-title: "Forecasting Growth"
-permalink: /docs/forecasting_growth.html
+docid: "saturating_forecasts"
+title: "Saturating Forecasts"
+permalink: /docs/saturating_forecasts.html
 ---
+### Forecasting Growth
+
 By default, Prophet uses a linear model for its forecast. When forecasting growth, there is usually some maximum achievable point: total market size, total population size, etc. This is called the carrying capacity, and the forecast should saturate at this point.
 
 Prophet allows you to make forecasts using a [logistic growth](https://en.wikipedia.org/wiki/Logistic_function) trend model, with a specified carrying capacity. We illustrate this with the log number of page visits to the [R (programming language)](https://en.wikipedia.org/wiki/R_%28programming_language%29) page on Wikipedia:
@@ -44,6 +46,13 @@ m <- prophet(df, growth = 'logistic')
 ```
 We make a dataframe for future predictions as before, except we must also specify the capacity in the future. Here we keep capacity constant at the same value as in the history, and forecast 3 years into the future:
 
+```R
+# R
+future <- make_future_dataframe(m, periods = 1826)
+future$cap <- 8.5
+fcst <- predict(m, future)
+plot(m, fcst);
+```
 ```python
 # Python
 future = m.make_future_dataframe(periods=1826)
@@ -51,13 +60,37 @@ future['cap'] = 8.5
 fcst = m.predict(future)
 m.plot(fcst);
 ```
+ 
+![png](/prophet/static/saturating_forecasts_files/saturating_forecasts_13_0.png) 
+
+
+### Saturating Minimum
+
+The logistic growth model can also handle a saturating minimum, which is specified with a column `floor` in the same way as the `cap` column specifies the maximum:
+
 ```R
 # R
-future <- make_future_dataframe(m, periods = 1826)
-future$cap <- 8.5
+df$y <- 10 - df$y
+df$cap <- 6
+df$floor <- 1.5
+future$cap <- 6
+future$floor <- 1.5
+m <- prophet(df, growth = 'logistic')
 fcst <- predict(m, future)
-plot(m, fcst);
+plot(m, fcst)
+```
+```python
+# Python
+df['y'] = 10 - df['y']
+df['cap'] = 6
+df['floor'] = 1.5
+future['cap'] = 6
+future['floor'] = 1.5
+m = Prophet(growth='logistic')
+m.fit(df)
+fcst = m.predict(future)
+m.plot(fcst);
 ```
  
-![png](/prophet/static/forecasting_growth_files/forecasting_growth_13_0.png) 
+![png](/prophet/static/saturating_forecasts_files/saturating_forecasts_16_0.png) 
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 367 - 0
docs/_docs/seasonality_and_holiday_effects.md


+ 1 - 1
docs/_docs/trend_changepoints.md

@@ -64,7 +64,7 @@ If you wish, rather than using automatic changepoint detection you can manually
 
 ```R
 # R
-m <- prophet(df, changepoints = c(as.Date('2014-01-01')))
+m <- prophet(df, changepoints = c('2014-01-01'))
 forecast <- predict(m, future)
 plot(m, forecast);
 ```

+ 4 - 2
docs/_docs/uncertainty_intervals.md

@@ -31,12 +31,12 @@ By default Prophet will only return uncertainty in the trend and observation noi
 
 ```python
 # Python
-m = Prophet(mcmc_samples=500)
+m = Prophet(mcmc_samples=300)
 forecast = m.fit(df).predict(future)
 ```
 ```R
 # R
-m <- prophet(df, mcmc.samples = 500)
+m <- prophet(df, mcmc.samples = 300)
 forecast <- predict(m, future)
 ```
 This replaces the typical MAP estimation with MCMC sampling, and takes much longer - think 10 minutes instead of 10 seconds. If you do full sampling, then you will see the uncertainty in seasonal components when you plot them:
@@ -53,4 +53,6 @@ prophet_plot_components(m, forecast);
 ![png](/prophet/static/uncertainty_intervals_files/uncertainty_intervals_10_0.png) 
 
 
+You can access the raw posterior predictive samples in Python using the method `m.predictive_samples(future)`, or in R using the function `predictive_samples(m, future)`.
+
 There are upstream issues in PyStan for Windows which make MCMC sampling extremely slow. The best choice for MCMC sampling in Windows is to use R, or Python in a Linux VM.

BIN
docs/static/diagnostics_files/diagnostics_3_0.png


BIN
docs/static/forecasting_growth_files/forecasting_growth_12_0.png


BIN
docs/static/forecasting_growth_files/forecasting_growth_13_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_10_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_12_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_13_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_3_1.png


BIN
docs/static/non-daily_data_files/non-daily_data_4_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_6_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_7_0.png


BIN
docs/static/non-daily_data_files/non-daily_data_9_1.png


BIN
docs/static/outliers_files/outliers_10_0.png


BIN
docs/static/outliers_files/outliers_12_1.png


BIN
docs/static/outliers_files/outliers_13_0.png


BIN
docs/static/outliers_files/outliers_3_1.png


BIN
docs/static/outliers_files/outliers_4_0.png


BIN
docs/static/outliers_files/outliers_6_1.png


BIN
docs/static/outliers_files/outliers_7_0.png


BIN
docs/static/outliers_files/outliers_9_1.png


BIN
docs/static/quick_start_files/quick_start_12_0.png


BIN
docs/static/quick_start_files/quick_start_14_0.png


BIN
docs/static/quick_start_files/quick_start_26_0.png


BIN
docs/static/quick_start_files/quick_start_27_0.png


BIN
docs/static/quick_start_files/quick_start_28_0.png


BIN
docs/static/quick_start_files/quick_start_29_0.png


BIN
docs/static/saturating_forecasts_files/saturating_forecasts_12_1.png


BIN
docs/static/saturating_forecasts_files/saturating_forecasts_13_0.png


BIN
docs/static/saturating_forecasts_files/saturating_forecasts_15_1.png


BIN
docs/static/saturating_forecasts_files/saturating_forecasts_16_0.png


BIN
docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_15_0.png


BIN
docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_16_0.png


BIN
docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_25_1.png


BIN
docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_26_0.png


BIN
docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_3_1.png


BIN
docs/static/seasonality_and_holiday_effects_files/seasonality_and_holiday_effects_4_0.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_10_0.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_12_1.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_13_0.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_16_1.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_17_0.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_4_0.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_6_0.png


BIN
docs/static/trend_changepoints_files/trend_changepoints_9_1.png


BIN
docs/static/uncertainty_intervals_files/uncertainty_intervals_10_0.png


BIN
docs/static/uncertainty_intervals_files/uncertainty_intervals_9_0.png


+ 7 - 3
notebooks/diagnostics.ipynb

@@ -63,7 +63,9 @@
   {
    "cell_type": "code",
    "execution_count": 3,
-   "metadata": {},
+   "metadata": {
+    "input_hidden": true
+   },
    "outputs": [
     {
      "data": {
@@ -109,7 +111,7 @@
    "source": [
     "[The Prophet paper](https://peerj.com/preprints/3190.pdf) gives further description of simulated historical forecasts.\n",
     "\n",
-    "This cross validation procedure can done automatically for a range of historical cutoffs using the `cross_validation` function. We specify the forecast horizon (`horizon`), and then optionally the size of the initial training period (`initial`) and the spacing between cutoff dates (`period`). By default, the initial training period is set to three times the horizon, and cutoffs are made every half a horizon.\n",
+    "This cross validation procedure can be done automatically for a range of historical cutoffs using the `cross_validation` function. We specify the forecast horizon (`horizon`), and then optionally the size of the initial training period (`initial`) and the spacing between cutoff dates (`period`). By default, the initial training period is set to three times the horizon, and cutoffs are made every half a horizon.\n",
     "\n",
     "The output of `cross_validation` is a dataframe with the true values `y` and the out-of-sample forecast values `yhat`, at each simulated forecast date and for each cutoff date. This dataframe can then be used to compute error measures of `yhat` vs. `y`."
    ]
@@ -117,7 +119,9 @@
   {
    "cell_type": "code",
    "execution_count": 4,
-   "metadata": {},
+   "metadata": {
+    "output_hidden": true
+   },
    "outputs": [
     {
      "data": {

+ 4 - 2
notebooks/non-daily_data.ipynb

@@ -45,7 +45,8 @@
    "cell_type": "code",
    "execution_count": 3,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "output_hidden": true
    },
    "outputs": [
     {
@@ -118,7 +119,8 @@
    "cell_type": "code",
    "execution_count": 5,
    "metadata": {
-    "collapsed": false
+    "collapsed": false,
+    "output_hidden": true
    },
    "outputs": [
     {

Diferenças do arquivo suprimidas por serem muito extensas
+ 31 - 93
notebooks/outliers.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 45 - 75
notebooks/quick_start.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 59 - 51
notebooks/saturating_forecasts.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 85 - 150
notebooks/seasonality_and_holiday_effects.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 20 - 52
notebooks/trend_changepoints.ipynb


Diferenças do arquivo suprimidas por serem muito extensas
+ 104 - 142
notebooks/uncertainty_intervals.ipynb