"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/_docs/quick_start.md" between
prophet-1.0.tar.gz and prophet-1.1.tar.gz

About: Prophet is a tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

quick_start.md  (prophet-1.0):quick_start.md  (prophet-1.1)
skipping to change at line 20 skipping to change at line 20
id: r-api id: r-api
--- ---
<a id="python-api"> </a> <a id="python-api"> </a>
## Python API ## Python API
Prophet follows the `sklearn` model API. We create an instance of the `Prophet` class and then call its `fit` and `predict` methods. Prophet follows the `sklearn` model API. We create an instance of the `Prophet` class and then call its `fit` and `predict` methods.
The input to Prophet is always a dataframe with two columns: `ds` and `y`. The `ds` (datestamp) column should be of a format expected by Pandas, ideally YYYY-M M-DD for a date or YYYY-MM-DD HH:MM:SS for a timestamp. The `y` column must be n umeric, and represents the measurement we wish to forecast. The input to Prophet is always a dataframe with two columns: `ds` and `y`. The `ds` (datestamp) column should be of a format expected by Pandas, ideally YYYY-M M-DD for a date or YYYY-MM-DD HH:MM:SS for a timestamp. The `y` column must be n umeric, and represents the measurement we wish to forecast.
As an example, let's look at a time series of the log daily page views for the W ikipedia page for [Peyton Manning](https://en.wikipedia.org/wiki/Peyton_Manning) . We scraped this data using the [Wikipediatrend](https://cran.r-project.org/pa ckage=wikipediatrend) package in R. Peyton Manning provides a nice example beca use it illustrates some of Prophet's features, like multiple seasonality, changi ng growth rates, and the ability to model special days (such as Manning's playof f and superbowl appearances). The CSV is available [here](https://github.com/fac ebook/prophet/blob/master/examples/example_wp_log_peyton_manning.csv). As an example, let's look at a time series of the log daily page views for the W ikipedia page for [Peyton Manning](https://en.wikipedia.org/wiki/Peyton_Manning) . We scraped this data using the [Wikipediatrend](https://cran.r-project.org/pa ckage=wikipediatrend) package in R. Peyton Manning provides a nice example beca use it illustrates some of Prophet's features, like multiple seasonality, changi ng growth rates, and the ability to model special days (such as Manning's playof f and superbowl appearances). The CSV is available [here](https://github.com/fac ebook/prophet/blob/main/examples/example_wp_log_peyton_manning.csv).
First we'll import the data: First we'll import the data:
```python ```python
# Python # Python
import pandas as pd import pandas as pd
from prophet import Prophet from prophet import Prophet
``` ```
```python ```python
# Python # Python
skipping to change at line 266 skipping to change at line 266
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. 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.
```R ```R
# R # R
library(prophet) library(prophet)
``` ```
R[write to console]: Loading required package: Rcpp R[write to console]: Loading required package: Rcpp
R[write to console]: Loading required package: rlang R[write to console]: Loading required package: rlang
First we read in the data and create the outcome variable. As in the Python API, this is a dataframe with columns `ds` and `y`, containing the date and numeric value respectively. The ds column should be YYYY-MM-DD for a date, or YYYY-MM-DD HH:MM:SS for a timestamp. As above, we use here the log number of views to Peyt on Manning's Wikipedia page, available [here](https://github.com/facebook/prophe t/blob/master/examples/example_wp_log_peyton_manning.csv). First we read in the data and create the outcome variable. As in the Python API, this is a dataframe with columns `ds` and `y`, containing the date and numeric value respectively. The ds column should be YYYY-MM-DD for a date, or YYYY-MM-DD HH:MM:SS for a timestamp. As above, we use here the log number of views to Peyt on Manning's Wikipedia page, available [here](https://github.com/facebook/prophe t/blob/main/examples/example_wp_log_peyton_manning.csv).
```R ```R
# R # R
df <- read.csv('../examples/example_wp_log_peyton_manning.csv') df <- read.csv('../examples/example_wp_log_peyton_manning.csv')
``` ```
We call the `prophet` function to fit the model. The first argument is the hist orical dataframe. Additional arguments control how Prophet fits the data and ar e described in later pages of this documentation. We call the `prophet` function to fit the model. The first argument is the hist orical dataframe. Additional arguments control how Prophet fits the data and ar e described in later pages of this documentation.
```R ```R
# R # R
m <- prophet(df) m <- prophet(df)
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)