prophet-rb 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +1 -1
- data/README.md +36 -9
- data/data-raw/LICENSE-holidays.txt +1 -1
- data/data-raw/README.md +1 -1
- data/data-raw/generated_holidays.csv +56365 -32386
- data/lib/prophet/diagnostics.rb +1 -1
- data/lib/prophet/forecaster.rb +32 -24
- data/lib/prophet/holidays.rb +3 -2
- data/lib/prophet/plot.rb +4 -4
- data/lib/prophet/stan_backend.rb +8 -6
- data/lib/prophet/version.rb +1 -1
- data/lib/prophet-rb.rb +1 -1
- data/lib/prophet.rb +10 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fd9d15984092c132cd6f13fa633e76e989de29ddd38f3f467803f7f76036466
|
4
|
+
data.tar.gz: 79b66208c4473e18a2da9fe8676d806d1e993f8f2723739f6ba4592d94b2b2f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de7a1a66e44a5846eebbdfc3fe77f7b43032e30562c276fb4e4422086887f689699046c683e4bc55b5291ac2cc80c28a9b8cdd5a2bddb218162a9c5fde6ebd30
|
7
|
+
data.tar.gz: 5ab4054e4e4f77a6b3255ee1f9fcb70b5e3aa02d74912960f2c2817c2b4e730d9c896959cd2e8dcaa0dc66338cece5e0130d967a3cdcc2b7c913f9a8fffb524b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.5.0 (2023-09-05)
|
2
|
+
|
3
|
+
- Added support for Polars
|
4
|
+
- Updated holidays
|
5
|
+
- Changed warning to error for unsupported country holidays
|
6
|
+
- Disabled logging by default
|
7
|
+
- Fixed error with `add_regressor` and holidays
|
8
|
+
- Dropped support for Ruby < 3
|
9
|
+
|
10
|
+
## 0.4.2 (2022-07-12)
|
11
|
+
|
12
|
+
- Fixed warning with `add_country_holidays` method
|
13
|
+
|
1
14
|
## 0.4.1 (2022-07-10)
|
2
15
|
|
3
16
|
- Added support for cross validation and performance metrics
|
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
3
|
Copyright (c) Facebook, Inc. and its affiliates.
|
4
|
-
Copyright (c) 2020-
|
4
|
+
Copyright (c) 2020-2023 Andrew Kane
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining
|
7
7
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -87,6 +87,7 @@ Check out the [Prophet documentation](https://facebook.github.io/prophet/docs/qu
|
|
87
87
|
- [Holidays and Special Events](#holidays-and-special-events)
|
88
88
|
- [Multiplicative Seasonality](#multiplicative-seasonality)
|
89
89
|
- [Uncertainty Intervals](#uncertainty-intervals)
|
90
|
+
- [Outliers](#outliers)
|
90
91
|
- [Non-Daily Data](#non-daily-data)
|
91
92
|
- [Diagnostics](#diagnostics)
|
92
93
|
- [Additional Topics](#additional-topics)
|
@@ -226,22 +227,24 @@ m = Prophet.new(changepoints: ["2014-01-01"])
|
|
226
227
|
Create a data frame with `holiday` and `ds` columns. Include all occurrences in your past data and future occurrences you’d like to forecast.
|
227
228
|
|
228
229
|
```ruby
|
229
|
-
playoffs = Rover::DataFrame.new(
|
230
|
+
playoffs = Rover::DataFrame.new({
|
230
231
|
"holiday" => "playoff",
|
231
|
-
"ds" => [
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
232
|
+
"ds" => [
|
233
|
+
"2008-01-13", "2009-01-03", "2010-01-16",
|
234
|
+
"2010-01-24", "2010-02-07", "2011-01-08",
|
235
|
+
"2013-01-12", "2014-01-12", "2014-01-19",
|
236
|
+
"2014-02-02", "2015-01-11", "2016-01-17",
|
237
|
+
"2016-01-24", "2016-02-07"
|
238
|
+
],
|
236
239
|
"lower_window" => 0,
|
237
240
|
"upper_window" => 1
|
238
|
-
)
|
239
|
-
superbowls = Rover::DataFrame.new(
|
241
|
+
})
|
242
|
+
superbowls = Rover::DataFrame.new({
|
240
243
|
"holiday" => "superbowl",
|
241
244
|
"ds" => ["2010-02-07", "2014-02-02", "2016-02-07"],
|
242
245
|
"lower_window" => 0,
|
243
246
|
"upper_window" => 1
|
244
|
-
)
|
247
|
+
})
|
245
248
|
holidays = playoffs.concat(superbowls)
|
246
249
|
|
247
250
|
m = Prophet.new(holidays: holidays)
|
@@ -287,6 +290,8 @@ forecast = m.predict(future)
|
|
287
290
|
|
288
291
|
[Explanation](https://facebook.github.io/prophet/docs/multiplicative_seasonality.html)
|
289
292
|
|
293
|
+
Specify multiplicative seasonality
|
294
|
+
|
290
295
|
```ruby
|
291
296
|
df = Rover.read_csv("example_air_passengers.csv")
|
292
297
|
m = Prophet.new(seasonality_mode: "multiplicative")
|
@@ -295,8 +300,18 @@ future = m.make_future_dataframe(periods: 50, freq: "MS")
|
|
295
300
|
forecast = m.predict(future)
|
296
301
|
```
|
297
302
|
|
303
|
+
Specify mode when adding seasonality and regressors
|
304
|
+
|
305
|
+
```ruby
|
306
|
+
m = Prophet.new(seasonality_mode: "multiplicative")
|
307
|
+
m.add_seasonality(name: "quarterly", period: 91.25, fourier_order: 8, mode: "additive")
|
308
|
+
m.add_regressor("regressor", mode: "additive")
|
309
|
+
```
|
310
|
+
|
298
311
|
## Uncertainty Intervals
|
299
312
|
|
313
|
+
[Explanation](https://facebook.github.io/prophet/docs/uncertainty_intervals.html)
|
314
|
+
|
300
315
|
Specify the width of uncertainty intervals (80% by default)
|
301
316
|
|
302
317
|
```ruby
|
@@ -309,6 +324,18 @@ Get uncertainty in seasonality
|
|
309
324
|
Prophet.new(mcmc_samples: 300)
|
310
325
|
```
|
311
326
|
|
327
|
+
## Outliers
|
328
|
+
|
329
|
+
[Explanation](https://facebook.github.io/prophet/docs/outliers.html)
|
330
|
+
|
331
|
+
Remove outliers
|
332
|
+
|
333
|
+
```ruby
|
334
|
+
df = Rover.read_csv("example_wp_log_R_outliers1.csv")
|
335
|
+
df["y"][(df["ds"] > "2010-01-01") & (df["ds"] < "2011-01-01")] = Float::NAN
|
336
|
+
m = Prophet.new.fit(df)
|
337
|
+
```
|
338
|
+
|
312
339
|
## Non-Daily Data
|
313
340
|
|
314
341
|
[Explanation](https://facebook.github.io/prophet/docs/non-daily_data.html)
|
data/data-raw/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
Holidays from 1995 through 2044 are generated from [this script](https://github.com/facebook/prophet/blob/main/python/scripts/generate_holidays_file.py).
|
2
2
|
|
3
|
-
The data is
|
3
|
+
The data is from the Python [holidays](https://pypi.org/project/holidays/) package.
|