prophet-rb 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/LICENSE.txt +1 -1
- data/README.md +51 -1
- data/data-raw/LICENSE-holidays.txt +20 -0
- data/data-raw/README.md +3 -0
- data/data-raw/generated_holidays.csv +29302 -61443
- data/lib/prophet/forecaster.rb +200 -0
- data/lib/prophet/holidays.rb +6 -10
- data/lib/prophet/stan_backend.rb +5 -5
- data/lib/prophet/version.rb +1 -1
- data/lib/prophet.rb +22 -7
- data/stan/{unix/prophet.stan → prophet.stan} +8 -7
- data/vendor/aarch64-linux/bin/prophet +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/lib/libtbb.so +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/lib/libtbb.so.2 +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/lib/libtbbmalloc.so +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/lib/libtbbmalloc.so.2 +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/lib/libtbbmalloc_proxy.so +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/lib/libtbbmalloc_proxy.so.2 +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/boost-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/cli11-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/cmdstan-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/eigen-bsd-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/eigen-mpl2-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/prophet-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/rapidjson-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/stan-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/stan-math-license.txt +0 -0
- data/vendor/aarch64-linux/licenses/sundials-license.txt +29 -0
- data/vendor/aarch64-linux/licenses/sundials-notice.txt +21 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/tbb-license.txt +0 -0
- data/vendor/{prophet-linux-arm → aarch64-linux}/licenses/tbb-third-party-programs.txt +0 -0
- data/vendor/arm64-darwin/bin/prophet +0 -0
- data/vendor/arm64-darwin/lib/libtbb.dylib +0 -0
- data/vendor/{prophet-mac-arm → arm64-darwin}/lib/libtbbmalloc.dylib +0 -0
- data/vendor/{prophet-mac-arm → arm64-darwin}/lib/libtbbmalloc_proxy.dylib +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/boost-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/cli11-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/cmdstan-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/eigen-bsd-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/eigen-mpl2-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/prophet-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/rapidjson-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/stan-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/stan-math-license.txt +0 -0
- data/vendor/arm64-darwin/licenses/sundials-license.txt +29 -0
- data/vendor/arm64-darwin/licenses/sundials-notice.txt +21 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/tbb-license.txt +0 -0
- data/vendor/{prophet-linux → arm64-darwin}/licenses/tbb-third-party-programs.txt +0 -0
- data/vendor/x86_64-darwin/bin/prophet +0 -0
- data/vendor/x86_64-darwin/lib/libtbb.dylib +0 -0
- data/vendor/{prophet-mac → x86_64-darwin}/lib/libtbbmalloc.dylib +0 -0
- data/vendor/{prophet-mac → x86_64-darwin}/lib/libtbbmalloc_proxy.dylib +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/boost-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/cli11-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/cmdstan-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/eigen-bsd-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/eigen-mpl2-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/prophet-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/rapidjson-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/stan-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/stan-math-license.txt +0 -0
- data/vendor/x86_64-darwin/licenses/sundials-license.txt +29 -0
- data/vendor/x86_64-darwin/licenses/sundials-notice.txt +21 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/tbb-license.txt +0 -0
- data/vendor/{prophet-mac-arm → x86_64-darwin}/licenses/tbb-third-party-programs.txt +0 -0
- data/vendor/x86_64-linux/bin/prophet +0 -0
- data/vendor/{prophet-linux → x86_64-linux}/lib/libtbb.so +0 -0
- data/vendor/x86_64-linux/lib/libtbb.so.2 +0 -0
- data/vendor/{prophet-linux → x86_64-linux}/lib/libtbbmalloc.so +0 -0
- data/vendor/x86_64-linux/lib/libtbbmalloc.so.2 +0 -0
- data/vendor/{prophet-linux → x86_64-linux}/lib/libtbbmalloc_proxy.so +0 -0
- data/vendor/{prophet-linux → x86_64-linux}/lib/libtbbmalloc_proxy.so.2 +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/boost-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/cli11-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/cmdstan-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/eigen-bsd-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/eigen-mpl2-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/prophet-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/rapidjson-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/stan-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/stan-math-license.txt +0 -0
- data/vendor/x86_64-linux/licenses/sundials-license.txt +29 -0
- data/vendor/x86_64-linux/licenses/sundials-notice.txt +21 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/tbb-license.txt +0 -0
- data/vendor/{prophet-mac → x86_64-linux}/licenses/tbb-third-party-programs.txt +0 -0
- metadata +79 -74
- data/stan/win/prophet.stan +0 -175
- data/vendor/prophet-linux/bin/prophet +0 -0
- data/vendor/prophet-linux/lib/libtbb.so.2 +0 -0
- data/vendor/prophet-linux/lib/libtbbmalloc.so.2 +0 -0
- data/vendor/prophet-linux/licenses/sundials-license.txt +0 -67
- data/vendor/prophet-linux-arm/bin/prophet +0 -0
- data/vendor/prophet-linux-arm/licenses/sundials-license.txt +0 -67
- data/vendor/prophet-mac/bin/prophet +0 -0
- data/vendor/prophet-mac/lib/libtbb.dylib +0 -0
- data/vendor/prophet-mac/licenses/sundials-license.txt +0 -67
- data/vendor/prophet-mac-arm/bin/prophet +0 -0
- data/vendor/prophet-mac-arm/lib/libtbb.dylib +0 -0
- data/vendor/prophet-mac-arm/licenses/sundials-license.txt +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bcbd43f3750bc8c70fe28f2b0b42e88464724601daa754a9d60d8e8e354c701
|
4
|
+
data.tar.gz: c16f1ab7f2d48419543b54f326fc98ac1261c7e5ceaf7d3b0fd352b87a2fdcb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8b3cf363a665f063d7045b3c34c124021281e063e61ff99e7bd98ba774a0e40a2d379aeb53f521833724b11d5ff1c7934820b73095ad5384b70066fc20e5e36
|
7
|
+
data.tar.gz: 177f8eab90b9be0e5112c3d158ef9b522309143c559a97ffa206b7cc63a83f0eb70e75d7e1f8ab9640e57e403bd85d1469ecdb9137b0be8acc03c7ff09a91447
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.4.0 (2022-07-07)
|
2
|
+
|
3
|
+
- Added support for saving and loading models
|
4
|
+
- Updated holidays
|
5
|
+
|
6
|
+
## 0.3.2 (2022-05-15)
|
7
|
+
|
8
|
+
- Added advanced API options to `forecast` and `anomalies` methods
|
9
|
+
|
10
|
+
## 0.3.1 (2022-04-28)
|
11
|
+
|
12
|
+
- Improved error message for missing columns
|
13
|
+
|
14
|
+
## 0.3.0 (2022-04-24)
|
2
15
|
|
3
16
|
- Switched to precompiled models
|
4
17
|
- Dropped support for Ruby < 2.7
|
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 Andrew Kane
|
4
|
+
Copyright (c) 2020-2022 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
@@ -22,6 +22,8 @@ gem "prophet-rb"
|
|
22
22
|
|
23
23
|
## Simple API
|
24
24
|
|
25
|
+
### Forecasting
|
26
|
+
|
25
27
|
Get future predictions for a time series
|
26
28
|
|
27
29
|
```ruby
|
@@ -48,16 +50,46 @@ series = User.group_by_day(:created_at).count
|
|
48
50
|
Prophet.forecast(series)
|
49
51
|
```
|
50
52
|
|
53
|
+
And supports [advanced API](#advanced-api) options
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
Prophet.forecast(series, growth: "logistic", weekly_seasonality: false)
|
57
|
+
```
|
58
|
+
|
59
|
+
### Anomaly Detection
|
60
|
+
|
51
61
|
Detect anomalies in a time series
|
52
62
|
|
53
63
|
```ruby
|
54
64
|
Prophet.anomalies(series)
|
55
65
|
```
|
56
66
|
|
67
|
+
Specify the width of uncertainty intervals (decrease for more anomalies)
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
Prophet.anomalies(series, interval_width: 0.99)
|
71
|
+
```
|
72
|
+
|
73
|
+
Also supports [advanced API](#advanced-api) options
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
Prophet.anomalies(series, growth: "logistic", weekly_seasonality: false)
|
77
|
+
```
|
78
|
+
|
57
79
|
## Advanced API
|
58
80
|
|
59
81
|
Check out the [Prophet documentation](https://facebook.github.io/prophet/docs/quick_start.html) for a great explanation of all of the features. The advanced API follows the Python API and supports the same features. It uses [Rover](https://github.com/ankane/rover) for data frames.
|
60
82
|
|
83
|
+
- [Quick Start](#advanced-quick-start)
|
84
|
+
- [Plots](#plots)
|
85
|
+
- [Saturating Forecasts](#saturating-forecasts)
|
86
|
+
- [Trend Changepoints](#trend-changepoints)
|
87
|
+
- [Holidays and Special Events](#holidays-and-special-events)
|
88
|
+
- [Multiplicative Seasonality](#multiplicative-seasonality)
|
89
|
+
- [Uncertainty Intervals](#uncertainty-intervals)
|
90
|
+
- [Non-Daily Data](#non-daily-data)
|
91
|
+
- [Saving Models](#saving-models)
|
92
|
+
|
61
93
|
## Advanced Quick Start
|
62
94
|
|
63
95
|
[Explanation](https://facebook.github.io/prophet/docs/quick_start.html)
|
@@ -206,7 +238,7 @@ Add country-specific holidays
|
|
206
238
|
|
207
239
|
```ruby
|
208
240
|
m = Prophet.new
|
209
|
-
m.add_country_holidays(
|
241
|
+
m.add_country_holidays("US")
|
210
242
|
m.fit(df)
|
211
243
|
```
|
212
244
|
|
@@ -276,6 +308,24 @@ future = m.make_future_dataframe(periods: 300, freq: "H")
|
|
276
308
|
forecast = m.predict(future)
|
277
309
|
```
|
278
310
|
|
311
|
+
## Saving Models
|
312
|
+
|
313
|
+
[Explanation](https://facebook.github.io/prophet/docs/additional_topics.html#saving-models)
|
314
|
+
|
315
|
+
Save a model
|
316
|
+
|
317
|
+
```ruby
|
318
|
+
File.write("model.json", m.to_json)
|
319
|
+
```
|
320
|
+
|
321
|
+
Load a model
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
m = Prophet.from_json(File.read("model.json"))
|
325
|
+
```
|
326
|
+
|
327
|
+
Uses the same format as Python, so models can be saved and loaded in either language
|
328
|
+
|
279
329
|
## Resources
|
280
330
|
|
281
331
|
- [Forecasting at Scale](https://peerj.com/preprints/3190.pdf)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2017-2022 <maurizio.montel@gmail.com>
|
2
|
+
Copyright (c) 2014-2017 <ryanssdev@icloud.com>
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
data/data-raw/README.md
ADDED