prophet-rb 0.2.3 → 0.3.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/README.md +14 -8
- data/lib/prophet/forecaster.rb +27 -7
- data/lib/prophet/stan_backend.rb +20 -1
- data/lib/prophet/version.rb +1 -1
- data/lib/prophet.rb +10 -0
- data/stan/unix/prophet.stan +27 -16
- data/stan/win/prophet.stan +15 -2
- data/vendor/prophet-linux/bin/prophet +0 -0
- data/vendor/prophet-linux/lib/libtbb.so +1 -0
- data/vendor/prophet-linux/lib/libtbb.so.2 +0 -0
- data/vendor/prophet-linux/lib/libtbbmalloc.so +1 -0
- data/vendor/prophet-linux/lib/libtbbmalloc.so.2 +0 -0
- data/vendor/prophet-linux/lib/libtbbmalloc_proxy.so +1 -0
- data/vendor/prophet-linux/lib/libtbbmalloc_proxy.so.2 +0 -0
- data/vendor/prophet-linux/licenses/boost-license.txt +23 -0
- data/vendor/prophet-linux/licenses/cli11-license.txt +25 -0
- data/vendor/prophet-linux/licenses/cmdstan-license.txt +27 -0
- data/vendor/prophet-linux/licenses/eigen-bsd-license.txt +26 -0
- data/vendor/prophet-linux/licenses/eigen-mpl2-license.txt +373 -0
- data/vendor/prophet-linux/licenses/prophet-license.txt +21 -0
- data/vendor/prophet-linux/licenses/rapidjson-license.txt +57 -0
- data/vendor/prophet-linux/licenses/stan-license.txt +14 -0
- data/vendor/prophet-linux/licenses/stan-math-license.txt +14 -0
- data/vendor/prophet-linux/licenses/sundials-license.txt +67 -0
- data/vendor/prophet-linux/licenses/tbb-license.txt +201 -0
- data/vendor/prophet-linux/licenses/tbb-third-party-programs.txt +230 -0
- data/vendor/prophet-linux-arm/bin/prophet +0 -0
- data/vendor/prophet-linux-arm/lib/libtbb.so +1 -0
- data/vendor/prophet-linux-arm/lib/libtbb.so.2 +0 -0
- data/vendor/prophet-linux-arm/lib/libtbbmalloc.so +1 -0
- data/vendor/prophet-linux-arm/lib/libtbbmalloc.so.2 +0 -0
- data/vendor/prophet-linux-arm/lib/libtbbmalloc_proxy.so +1 -0
- data/vendor/prophet-linux-arm/lib/libtbbmalloc_proxy.so.2 +0 -0
- data/vendor/prophet-linux-arm/licenses/boost-license.txt +23 -0
- data/vendor/prophet-linux-arm/licenses/cli11-license.txt +25 -0
- data/vendor/prophet-linux-arm/licenses/cmdstan-license.txt +27 -0
- data/vendor/prophet-linux-arm/licenses/eigen-bsd-license.txt +26 -0
- data/vendor/prophet-linux-arm/licenses/eigen-mpl2-license.txt +373 -0
- data/vendor/prophet-linux-arm/licenses/prophet-license.txt +21 -0
- data/vendor/prophet-linux-arm/licenses/rapidjson-license.txt +57 -0
- data/vendor/prophet-linux-arm/licenses/stan-license.txt +14 -0
- data/vendor/prophet-linux-arm/licenses/stan-math-license.txt +14 -0
- data/vendor/prophet-linux-arm/licenses/sundials-license.txt +67 -0
- data/vendor/prophet-linux-arm/licenses/tbb-license.txt +201 -0
- data/vendor/prophet-linux-arm/licenses/tbb-third-party-programs.txt +230 -0
- data/vendor/prophet-mac/bin/prophet +0 -0
- data/vendor/prophet-mac/lib/libtbb.dylib +0 -0
- data/vendor/prophet-mac/lib/libtbbmalloc.dylib +0 -0
- data/vendor/prophet-mac/lib/libtbbmalloc_proxy.dylib +0 -0
- data/vendor/prophet-mac/licenses/boost-license.txt +23 -0
- data/vendor/prophet-mac/licenses/cli11-license.txt +25 -0
- data/vendor/prophet-mac/licenses/cmdstan-license.txt +27 -0
- data/vendor/prophet-mac/licenses/eigen-bsd-license.txt +26 -0
- data/vendor/prophet-mac/licenses/eigen-mpl2-license.txt +373 -0
- data/vendor/prophet-mac/licenses/prophet-license.txt +21 -0
- data/vendor/prophet-mac/licenses/rapidjson-license.txt +57 -0
- data/vendor/prophet-mac/licenses/stan-license.txt +14 -0
- data/vendor/prophet-mac/licenses/stan-math-license.txt +14 -0
- data/vendor/prophet-mac/licenses/sundials-license.txt +67 -0
- data/vendor/prophet-mac/licenses/tbb-license.txt +201 -0
- data/vendor/prophet-mac/licenses/tbb-third-party-programs.txt +230 -0
- data/vendor/prophet-mac-arm/bin/prophet +0 -0
- data/vendor/prophet-mac-arm/lib/libtbb.dylib +0 -0
- data/vendor/prophet-mac-arm/lib/libtbbmalloc.dylib +0 -0
- data/vendor/prophet-mac-arm/lib/libtbbmalloc_proxy.dylib +0 -0
- data/vendor/prophet-mac-arm/licenses/boost-license.txt +23 -0
- data/vendor/prophet-mac-arm/licenses/cli11-license.txt +25 -0
- data/vendor/prophet-mac-arm/licenses/cmdstan-license.txt +27 -0
- data/vendor/prophet-mac-arm/licenses/eigen-bsd-license.txt +26 -0
- data/vendor/prophet-mac-arm/licenses/eigen-mpl2-license.txt +373 -0
- data/vendor/prophet-mac-arm/licenses/prophet-license.txt +21 -0
- data/vendor/prophet-mac-arm/licenses/rapidjson-license.txt +57 -0
- data/vendor/prophet-mac-arm/licenses/stan-license.txt +14 -0
- data/vendor/prophet-mac-arm/licenses/stan-math-license.txt +14 -0
- data/vendor/prophet-mac-arm/licenses/sundials-license.txt +67 -0
- data/vendor/prophet-mac-arm/licenses/tbb-license.txt +201 -0
- data/vendor/prophet-mac-arm/licenses/tbb-third-party-programs.txt +230 -0
- metadata +83 -114
- data/ext/prophet/Makefile +0 -5
- data/ext/prophet/extconf.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf304cc6aa3af6ec1165de157a38b92ca32f1423c0ac9807d69407c566ccb72b
|
|
4
|
+
data.tar.gz: 8e86c3b881113af71d5636e221b1bc3d5692fda0245946be19b6bd32151a9205
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 123be484141a21957e8e137eeba5c316e773f7e0e8049ad2db719ddafb97d0455d5c8d414452ff46a97f910c0f082a3b38a613e0635061c073a1b81270cf38b5
|
|
7
|
+
data.tar.gz: 958f8774ef5fce334645ff8fa42124e7535d7d69d344b929a53462a0e9296ec68e82465980bdb8b9f08bc62ddb7e6e3876d9371f85ff0cbbca8c36238375759d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## 0.3.0 (2021-04-24)
|
|
2
|
+
|
|
3
|
+
- Switched to precompiled models
|
|
4
|
+
- Dropped support for Ruby < 2.7
|
|
5
|
+
|
|
6
|
+
## 0.2.5 (2021-07-28)
|
|
7
|
+
|
|
8
|
+
- Added `anomalies` method
|
|
9
|
+
|
|
10
|
+
## 0.2.4 (2021-04-02)
|
|
11
|
+
|
|
12
|
+
- Added support for flat growth
|
|
13
|
+
|
|
1
14
|
## 0.2.3 (2020-10-14)
|
|
2
15
|
|
|
3
16
|
- Added support for times to `forecast` method
|
data/README.md
CHANGED
|
@@ -10,14 +10,14 @@ Supports:
|
|
|
10
10
|
|
|
11
11
|
And gracefully handles missing data
|
|
12
12
|
|
|
13
|
-
[](https://github.com/ankane/prophet-ruby/actions)
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
17
|
Add this line to your application’s Gemfile:
|
|
18
18
|
|
|
19
19
|
```ruby
|
|
20
|
-
gem
|
|
20
|
+
gem "prophet-rb"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Simple API
|
|
@@ -48,6 +48,12 @@ series = User.group_by_day(:created_at).count
|
|
|
48
48
|
Prophet.forecast(series)
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
Detect anomalies in a time series
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
Prophet.anomalies(series)
|
|
55
|
+
```
|
|
56
|
+
|
|
51
57
|
## Advanced API
|
|
52
58
|
|
|
53
59
|
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.
|
|
@@ -289,23 +295,23 @@ This library was ported from the [Prophet Python library](https://github.com/fac
|
|
|
289
295
|
|
|
290
296
|
## History
|
|
291
297
|
|
|
292
|
-
View the [changelog](https://github.com/ankane/prophet/blob/master/CHANGELOG.md)
|
|
298
|
+
View the [changelog](https://github.com/ankane/prophet-ruby/blob/master/CHANGELOG.md)
|
|
293
299
|
|
|
294
300
|
## Contributing
|
|
295
301
|
|
|
296
302
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
|
297
303
|
|
|
298
|
-
- [Report bugs](https://github.com/ankane/prophet/issues)
|
|
299
|
-
- Fix bugs and [submit pull requests](https://github.com/ankane/prophet/pulls)
|
|
304
|
+
- [Report bugs](https://github.com/ankane/prophet-ruby/issues)
|
|
305
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/prophet-ruby/pulls)
|
|
300
306
|
- Write, clarify, or fix documentation
|
|
301
307
|
- Suggest or add new features
|
|
302
308
|
|
|
303
309
|
To get started with development:
|
|
304
310
|
|
|
305
311
|
```sh
|
|
306
|
-
git clone https://github.com/ankane/prophet.git
|
|
307
|
-
cd prophet
|
|
312
|
+
git clone https://github.com/ankane/prophet-ruby.git
|
|
313
|
+
cd prophet-ruby
|
|
308
314
|
bundle install
|
|
309
|
-
bundle exec
|
|
315
|
+
bundle exec rake vendor:all
|
|
310
316
|
bundle exec rake test
|
|
311
317
|
```
|
data/lib/prophet/forecaster.rb
CHANGED
|
@@ -75,8 +75,8 @@ module Prophet
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def validate_inputs
|
|
78
|
-
if !["linear", "logistic"].include?(@growth)
|
|
79
|
-
raise ArgumentError, "Parameter \"growth\" should be \"linear\" or \"
|
|
78
|
+
if !["linear", "logistic", "flat"].include?(@growth)
|
|
79
|
+
raise ArgumentError, "Parameter \"growth\" should be \"linear\", \"logistic\", or \"flat\"."
|
|
80
80
|
end
|
|
81
81
|
if @changepoint_range < 0 || @changepoint_range > 1
|
|
82
82
|
raise ArgumentError, "Parameter \"changepoint_range\" must be in [0, 1]"
|
|
@@ -143,7 +143,7 @@ module Prophet
|
|
|
143
143
|
def setup_dataframe(df, initialize_scales: false)
|
|
144
144
|
if df.include?("y")
|
|
145
145
|
df["y"] = df["y"].map(&:to_f)
|
|
146
|
-
raise ArgumentError "Found infinity in column y." unless df["y"].all?(&:finite?)
|
|
146
|
+
raise ArgumentError, "Found infinity in column y." unless df["y"].all?(&:finite?)
|
|
147
147
|
end
|
|
148
148
|
# TODO support integers
|
|
149
149
|
|
|
@@ -602,6 +602,12 @@ module Prophet
|
|
|
602
602
|
[k, m]
|
|
603
603
|
end
|
|
604
604
|
|
|
605
|
+
def flat_growth_init(df)
|
|
606
|
+
k = 0
|
|
607
|
+
m = df["y_scaled"].mean
|
|
608
|
+
[k, m]
|
|
609
|
+
end
|
|
610
|
+
|
|
605
611
|
def fit(df, **kwargs)
|
|
606
612
|
raise Error, "Prophet object can only be fit once" if @history
|
|
607
613
|
|
|
@@ -624,6 +630,8 @@ module Prophet
|
|
|
624
630
|
|
|
625
631
|
set_changepoints
|
|
626
632
|
|
|
633
|
+
trend_indicator = {"linear" => 0, "logistic" => 1, "flat" => 2}
|
|
634
|
+
|
|
627
635
|
dat = {
|
|
628
636
|
"T" => history.shape[0],
|
|
629
637
|
"K" => seasonal_features.shape[1],
|
|
@@ -634,7 +642,7 @@ module Prophet
|
|
|
634
642
|
"X" => seasonal_features,
|
|
635
643
|
"sigmas" => prior_scales,
|
|
636
644
|
"tau" => @changepoint_prior_scale,
|
|
637
|
-
"trend_indicator" => @growth
|
|
645
|
+
"trend_indicator" => trend_indicator[@growth],
|
|
638
646
|
"s_a" => component_cols["additive_terms"],
|
|
639
647
|
"s_m" => component_cols["multiplicative_terms"]
|
|
640
648
|
}
|
|
@@ -642,6 +650,9 @@ module Prophet
|
|
|
642
650
|
if @growth == "linear"
|
|
643
651
|
dat["cap"] = Numo::DFloat.zeros(@history.shape[0])
|
|
644
652
|
kinit = linear_growth_init(history)
|
|
653
|
+
elsif @growth == "flat"
|
|
654
|
+
dat["cap"] = Numo::DFloat.zeros(@history.shape[0])
|
|
655
|
+
kinit = flat_growth_init(history)
|
|
645
656
|
else
|
|
646
657
|
dat["cap"] = history["cap_scaled"]
|
|
647
658
|
kinit = logistic_growth_init(history)
|
|
@@ -655,7 +666,7 @@ module Prophet
|
|
|
655
666
|
"sigma_obs" => 1
|
|
656
667
|
}
|
|
657
668
|
|
|
658
|
-
if history["y"].min == history["y"].max && @growth == "linear"
|
|
669
|
+
if history["y"].min == history["y"].max && (@growth == "linear" || @growth == "flat")
|
|
659
670
|
# Nothing to fit.
|
|
660
671
|
@params = stan_init
|
|
661
672
|
@params["sigma_obs"] = 1e-9
|
|
@@ -741,6 +752,11 @@ module Prophet
|
|
|
741
752
|
cap.to_numo / (1 + Numo::NMath.exp(-k_t * (t - m_t)))
|
|
742
753
|
end
|
|
743
754
|
|
|
755
|
+
def flat_trend(t, m)
|
|
756
|
+
m_t = m * t.new_ones
|
|
757
|
+
m_t
|
|
758
|
+
end
|
|
759
|
+
|
|
744
760
|
def predict_trend(df)
|
|
745
761
|
k = @params["k"].mean(nan: true)
|
|
746
762
|
m = @params["m"].mean(nan: true)
|
|
@@ -749,9 +765,11 @@ module Prophet
|
|
|
749
765
|
t = Numo::NArray.asarray(df["t"].to_a)
|
|
750
766
|
if @growth == "linear"
|
|
751
767
|
trend = piecewise_linear(t, deltas, k, m, @changepoints_t)
|
|
752
|
-
|
|
768
|
+
elsif @growth == "logistic"
|
|
753
769
|
cap = df["cap_scaled"]
|
|
754
770
|
trend = piecewise_logistic(t, cap, deltas, k, m, @changepoints_t)
|
|
771
|
+
elsif @growth == "flat"
|
|
772
|
+
trend = flat_trend(t, m)
|
|
755
773
|
end
|
|
756
774
|
|
|
757
775
|
trend * @y_scale + Numo::NArray.asarray(df["floor"].to_a)
|
|
@@ -887,9 +905,11 @@ module Prophet
|
|
|
887
905
|
|
|
888
906
|
if @growth == "linear"
|
|
889
907
|
trend = piecewise_linear(t, deltas, k, m, changepoint_ts)
|
|
890
|
-
|
|
908
|
+
elsif @growth == "logistic"
|
|
891
909
|
cap = df["cap_scaled"]
|
|
892
910
|
trend = piecewise_logistic(t, cap, deltas, k, m, changepoint_ts)
|
|
911
|
+
elsif @growth == "flat"
|
|
912
|
+
trend = flat_trend(t, m)
|
|
893
913
|
end
|
|
894
914
|
|
|
895
915
|
trend * @y_scale + Numo::NArray.asarray(df["floor"].to_a)
|
data/lib/prophet/stan_backend.rb
CHANGED
|
@@ -6,7 +6,8 @@ module Prophet
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def load_model
|
|
9
|
-
model_file = File.expand_path("../../
|
|
9
|
+
model_file = File.expand_path("../../vendor/prophet-#{platform}/bin/prophet", __dir__)
|
|
10
|
+
raise Error, "Platform not supported yet" unless File.exist?(model_file)
|
|
10
11
|
CmdStan::Model.new(exe_file: model_file)
|
|
11
12
|
end
|
|
12
13
|
|
|
@@ -132,5 +133,23 @@ module Prophet
|
|
|
132
133
|
stan_init["beta"] = stan_init["beta"].to_a
|
|
133
134
|
[stan_init, stan_data]
|
|
134
135
|
end
|
|
136
|
+
|
|
137
|
+
def platform
|
|
138
|
+
if Gem.win_platform?
|
|
139
|
+
"windows"
|
|
140
|
+
elsif RbConfig::CONFIG["host_os"] =~ /darwin/i
|
|
141
|
+
if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
|
|
142
|
+
"mac-arm"
|
|
143
|
+
else
|
|
144
|
+
"mac"
|
|
145
|
+
end
|
|
146
|
+
else
|
|
147
|
+
if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
|
|
148
|
+
"linux-arm"
|
|
149
|
+
else
|
|
150
|
+
"linux"
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
135
154
|
end
|
|
136
155
|
end
|
data/lib/prophet/version.rb
CHANGED
data/lib/prophet.rb
CHANGED
|
@@ -83,4 +83,14 @@ module Prophet
|
|
|
83
83
|
end
|
|
84
84
|
result.map { |v| [v["ds"], v["yhat"]] }.to_h
|
|
85
85
|
end
|
|
86
|
+
|
|
87
|
+
def self.anomalies(series)
|
|
88
|
+
df = Rover::DataFrame.new(series.map { |k, v| {"ds" => k, "y" => v} })
|
|
89
|
+
m = Prophet.new(interval_width: 0.99)
|
|
90
|
+
m.logger.level = ::Logger::FATAL # no logging
|
|
91
|
+
m.fit(df)
|
|
92
|
+
forecast = m.predict(df)
|
|
93
|
+
# filter df["ds"] to ensure dates/times in same format as input
|
|
94
|
+
df["ds"][(df["y"] < forecast["yhat_lower"]) | (df["y"] > forecast["yhat_upper"])].to_a
|
|
95
|
+
end
|
|
86
96
|
end
|
data/stan/unix/prophet.stan
CHANGED
|
@@ -73,6 +73,15 @@ functions {
|
|
|
73
73
|
) {
|
|
74
74
|
return (k + A * delta) .* t + (m + A * (-t_change .* delta));
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
// Flat trend function
|
|
78
|
+
|
|
79
|
+
vector flat_trend(
|
|
80
|
+
real m,
|
|
81
|
+
int T
|
|
82
|
+
) {
|
|
83
|
+
return rep_vector(m, T);
|
|
84
|
+
}
|
|
76
85
|
}
|
|
77
86
|
|
|
78
87
|
data {
|
|
@@ -86,7 +95,7 @@ data {
|
|
|
86
95
|
matrix[T,K] X; // Regressors
|
|
87
96
|
vector[K] sigmas; // Scale on seasonality prior
|
|
88
97
|
real<lower=0> tau; // Scale on changepoints prior
|
|
89
|
-
int trend_indicator; // 0 for linear, 1 for logistic
|
|
98
|
+
int trend_indicator; // 0 for linear, 1 for logistic, 2 for flat
|
|
90
99
|
vector[K] s_a; // Indicator of additive features
|
|
91
100
|
vector[K] s_m; // Indicator of multiplicative features
|
|
92
101
|
}
|
|
@@ -104,6 +113,17 @@ parameters {
|
|
|
104
113
|
vector[K] beta; // Regressor coefficients
|
|
105
114
|
}
|
|
106
115
|
|
|
116
|
+
transformed parameters {
|
|
117
|
+
vector[T] trend;
|
|
118
|
+
if (trend_indicator == 0) {
|
|
119
|
+
trend = linear_trend(k, m, delta, t, A, t_change);
|
|
120
|
+
} else if (trend_indicator == 1) {
|
|
121
|
+
trend = logistic_trend(k, m, delta, t, cap, A, t_change, S);
|
|
122
|
+
} else if (trend_indicator == 2) {
|
|
123
|
+
trend = flat_trend(m, T);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
107
127
|
model {
|
|
108
128
|
//priors
|
|
109
129
|
k ~ normal(0, 5);
|
|
@@ -113,19 +133,10 @@ model {
|
|
|
113
133
|
beta ~ normal(0, sigmas);
|
|
114
134
|
|
|
115
135
|
// Likelihood
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
} else if (trend_indicator == 1) {
|
|
124
|
-
y ~ normal(
|
|
125
|
-
logistic_trend(k, m, delta, t, cap, A, t_change, S)
|
|
126
|
-
.* (1 + X * (beta .* s_m))
|
|
127
|
-
+ X * (beta .* s_a),
|
|
128
|
-
sigma_obs
|
|
129
|
-
);
|
|
130
|
-
}
|
|
136
|
+
y ~ normal(
|
|
137
|
+
trend
|
|
138
|
+
.* (1 + X * (beta .* s_m))
|
|
139
|
+
+ X * (beta .* s_a),
|
|
140
|
+
sigma_obs
|
|
141
|
+
);
|
|
131
142
|
}
|
data/stan/win/prophet.stan
CHANGED
|
@@ -47,7 +47,7 @@ functions {
|
|
|
47
47
|
}
|
|
48
48
|
return gamma;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
real[] logistic_trend(
|
|
52
52
|
real k,
|
|
53
53
|
real m,
|
|
@@ -94,6 +94,17 @@ functions {
|
|
|
94
94
|
}
|
|
95
95
|
return Y;
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
// Flat trend function
|
|
99
|
+
|
|
100
|
+
real[] flat_trend(
|
|
101
|
+
real m,
|
|
102
|
+
int T
|
|
103
|
+
) {
|
|
104
|
+
return rep_array(m, T);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
97
108
|
}
|
|
98
109
|
|
|
99
110
|
data {
|
|
@@ -107,7 +118,7 @@ data {
|
|
|
107
118
|
real X[T,K]; // Regressors
|
|
108
119
|
vector[K] sigmas; // Scale on seasonality prior
|
|
109
120
|
real<lower=0> tau; // Scale on changepoints prior
|
|
110
|
-
int trend_indicator; // 0 for linear, 1 for logistic
|
|
121
|
+
int trend_indicator; // 0 for linear, 1 for logistic, 2 for flat
|
|
111
122
|
real s_a[K]; // Indicator of additive features
|
|
112
123
|
real s_m[K]; // Indicator of multiplicative features
|
|
113
124
|
}
|
|
@@ -135,6 +146,8 @@ transformed parameters {
|
|
|
135
146
|
trend = linear_trend(k, m, delta, t, A, t_change, S, T);
|
|
136
147
|
} else if (trend_indicator == 1) {
|
|
137
148
|
trend = logistic_trend(k, m, delta, t, cap, A, t_change, S, T);
|
|
149
|
+
} else if (trend_indicator == 2){
|
|
150
|
+
trend = flat_trend(m, T);
|
|
138
151
|
}
|
|
139
152
|
|
|
140
153
|
for (i in 1:K) {
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
INPUT (libtbb.so.2)
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
INPUT (libtbbmalloc.so.2)
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
INPUT (libtbbmalloc_proxy.so.2)
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
4
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
5
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
6
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
7
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
8
|
+
do so, all subject to the following:
|
|
9
|
+
|
|
10
|
+
The copyright notices in the Software and this entire statement, including
|
|
11
|
+
the above license grant, this restriction and the following disclaimer,
|
|
12
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
13
|
+
all derivative works of the Software, unless such copies or derivative
|
|
14
|
+
works are solely in the form of machine-executable object code generated by
|
|
15
|
+
a source language processor.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
20
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
21
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
22
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
CLI11 1.8 Copyright (c) 2017-2019 University of Cincinnati, developed by Henry
|
|
2
|
+
Schreiner under NSF AWARD 1414736. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms of CLI11, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
13
|
+
may be used to endorse or promote products derived from this software without
|
|
14
|
+
specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2014, Stan
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
11
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
12
|
+
other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of the {organization} nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2011, Intel Corporation. All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name of Intel Corporation nor the names of its contributors may
|
|
13
|
+
be used to endorse or promote products derived from this software without
|
|
14
|
+
specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
17
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
21
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
22
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
23
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
24
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
*/
|