README.md in prophet-rb-0.1.0 vs README.md in prophet-rb-0.1.1
- old
+ new
@@ -8,10 +8,12 @@
- Linear and non-linear growth
- Holidays and special events
And gracefully handles missing data
+[](https://travis-ci.org/ankane/prophet)
+
## Installation
Add this line to your application’s Gemfile:
```ruby
@@ -96,10 +98,49 @@
m.plot_components(forecast).savefig("components.png")
```

+## Saturating Forecasts
+
+[Explanation](https://facebook.github.io/prophet/docs/saturating_forecasts.html)
+
+Forecast logistic growth instead of linear
+
+```ruby
+df = Daru::DataFrame.from_csv("example_wp_log_R.csv")
+df["cap"] = 8.5
+m = Prophet.new(growth: "logistic")
+m.fit(df)
+future = m.make_future_dataframe(periods: 365)
+future["cap"] = 8.5
+forecast = m.predict(future)
+```
+
+## Trend Changepoints
+
+[Explanation](https://facebook.github.io/prophet/docs/trend_changepoints.html)
+
+Plot changepoints
+
+```ruby
+fig = m.plot(forecast)
+m.add_changepoints_to_plot(fig.gca, forecast)
+```
+
+Adjust trend flexibility
+
+```ruby
+m = Prophet.new(changepoint_prior_scale: 0.5)
+```
+
+Specify the location of changepoints
+
+```ruby
+m = Prophet.new(changepoints: ["2014-01-01"])
+```
+
## Holidays and Special Events
[Explanation](https://facebook.github.io/prophet/docs/seasonality,_holiday_effects,_and_regressors.html)
Create a data frame with `holiday` and `ds` columns. Include all occurrences in your past data and future occurrences you’d like to forecast.
@@ -139,13 +180,31 @@
```ruby
m = Prophet.new(weekly_seasonality: false)
m.add_seasonality(name: "monthly", period: 30.5, fourier_order: 5)
forecast = m.fit(df).predict(future)
-m.plot_components(forecast).savefig("components.png")
```
+Specify additional regressors
+
+```ruby
+nfl_sunday = lambda do |ds|
+ date = ds.respond_to?(:to_date) ? ds.to_date : Date.parse(ds)
+ date.wday == 0 && (date.month > 8 || date.month < 2) ? 1 : 0
+end
+
+df["nfl_sunday"] = df["ds"].map(&nfl_sunday)
+
+m = Prophet.new
+m.add_regressor("nfl_sunday")
+m.fit(df)
+
+future["nfl_sunday"] = future["ds"].map(&nfl_sunday)
+
+forecast = m.predict(future)
+```
+
## Multiplicative Seasonality
[Explanation](https://facebook.github.io/prophet/docs/multiplicative_seasonality.html)
```ruby
@@ -154,21 +213,34 @@
m.fit(df)
future = m.make_future_dataframe(periods: 50, freq: "MS")
forecast = m.predict(future)
```
+## Uncertainty Intervals
+
+Specify the width of uncertainty intervals (80% by default)
+
+```ruby
+Prophet.new(interval_width: 0.95)
+```
+
+Get uncertainty in seasonality
+
+```ruby
+Prophet.new(mcmc_samples: 300)
+```
+
## Non-Daily Data
[Explanation](https://facebook.github.io/prophet/docs/non-daily_data.html)
Sub-daily data
```ruby
df = Daru::DataFrame.from_csv("example_yosemite_temps.csv")
m = Prophet.new(changepoint_prior_scale: 0.01).fit(df)
future = m.make_future_dataframe(periods: 300, freq: "H")
-fcst = m.predict(future)
-m.plot(fcst).savefig("forecast.png")
+forecast = m.predict(future)
```
## Resources
- [Forecasting at Scale](https://peerj.com/preprints/3190.pdf)