stinoco commited on
Commit
c97655d
·
1 Parent(s): 1d407df

added app.py

Browse files
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from get_forecast import get_forecast
2
+ import gradio as gr
3
+
4
+ with gr.Blocks() as demo:
5
+
6
+ gr.Markdown(
7
+ """
8
+ # AB InBev Data Science Challenge
9
+ This is a demo built for AB InBev company to forecast **SOM** and **Volume** series. This demo allows the user to analyze the price sensibility of the mentioned series. Enjoy!
10
+ ## How do you use this demo?
11
+ Using this demo is easy! Simply follow the next steps:
12
+ 1. Select a Serie to forecast from the dropdown (valid values: SOM and Volumen)
13
+ 2. Choose how many months ahead do you wish your forecast to predict
14
+ 3. Pick the price variation vs last year you want to analyze. Setting this value to 0 means the future price values are exactly the same as the last year.
15
+ """)
16
+
17
+ with gr.Row():
18
+ serie = gr.Dropdown(choices = ['SOM', 'Volumen'], value = 'SOM', label = 'Serie', info = 'Choose the serie to forecast')
19
+ periods = gr.Slider(minimum = 1, maximum = 12, step = 1, value = 3, label = 'Months')
20
+ percent_change = gr.Slider(minimum = -100, maximum = 100, step = 5, value = -5, label = '% Change vs Last Year')
21
+
22
+ plot = gr.Plot()
23
+
24
+ serie.change(get_forecast, [serie, periods, percent_change], plot, queue=False)
25
+ periods.change(get_forecast, [serie, periods, percent_change], plot, queue=False)
26
+ percent_change.change(get_forecast, [serie, periods, percent_change], plot, queue=False)
27
+ plot.change(get_forecast, [serie, periods, percent_change], plot, queue=False)
28
+ demo.load(get_forecast, [serie, periods, percent_change], plot, queue=False)
29
+
30
+ demo.launch(debug = False)
data/som_data.csv ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ds;y;precio_hl
2
+ 2019-09-01;0.020915653261496473;7401.807657174472
3
+ 2019-10-01;0.020581492528706422;7690.883661312737
4
+ 2019-11-01;0.020928808454534462;7543.184995957615
5
+ 2019-12-01;0.018754425666550188;7310.693659862146
6
+ 2020-01-01;0.02302447244897762;7238.999879400494
7
+ 2020-02-01;0.022806337555348007;7384.595116461657
8
+ 2020-03-01;0.022806150221354564;7606.022219882967
9
+ 2020-04-01;0.024818567088805782;6641.800669106801
10
+ 2020-05-01;0.0274311269204994;6541.786707784563
11
+ 2020-06-01;0.026539351889114132;6670.899239709285
12
+ 2020-07-01;0.034426844435406806;6880.257062804495
13
+ 2020-08-01;0.034388557604764836;6859.994191302926
14
+ 2020-09-01;0.03214360739132953;6650.605461375102
15
+ 2020-10-01;0.030103086698821023;7109.852838006651
16
+ 2020-11-01;0.02655257622967919;7113.3090297969875
17
+ 2020-12-01;0.02734047812743239;7197.972073541302
18
+ 2021-01-01;0.026089987008928173;6374.009481095359
19
+ 2021-02-01;0.025612409955957597;7011.995289620221
20
+ 2021-03-01;0.02240233628534395;7282.817007379381
21
+ 2021-04-01;0.024883998075455216;7897.530131607511
22
+ 2021-05-01;0.02376304605512934;7500.698636152339
23
+ 2021-06-01;0.02368671149006748;7954.630801419836
24
+ 2021-07-01;0.020318662312505783;7258.247057883863
25
+ 2021-08-01;0.01968912735303638;7534.222846892518
26
+ 2021-09-01;0.01945239533267099;6536.559231045296
27
+ 2021-10-01;0.023854422999473247;7027.180461980301
28
+ 2021-11-01;0.02308125053238265;7523.51279634985
29
+ 2021-12-01;0.02004340977554878;7459.715436564322
30
+ 2022-01-01;0.020192252849173826;7050.156843690086
31
+ 2022-02-01;0.021809051071164234;6949.758834627189
32
+ 2022-03-01;0.0230171214550591;7032.027423804479
33
+ 2022-04-01;0.02648682876822832;7692.4848674508
34
+ 2022-05-01;0.02349760546286519;7462.713414643129
35
+ 2022-06-01;0.023459162166123263;7658.313830664824
36
+ 2022-07-01;0.023312392516184378;7667.218777734914
37
+ 2022-08-01;0.027115976192388886;7143.871781123152
38
+ 2022-09-01;0.028064184905544503;7530.285881422287
data/volumen_data.csv ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ds;y;precio_hl
2
+ 2019-09-01;2158.4562666666666;7401.807657174472
3
+ 2019-10-01;2150.84358;7690.883661312737
4
+ 2019-11-01;1605.3423333333335;7543.184995957615
5
+ 2019-12-01;1728.7750285714285;7310.693659862146
6
+ 2020-01-01;2948.445853846154;7238.999879400494
7
+ 2020-02-01;2742.9243846153845;7384.595116461657
8
+ 2020-03-01;2622.698146153846;7606.022219882967
9
+ 2020-04-01;1036.4133250000002;6641.800669106801
10
+ 2020-05-01;1110.5237666666667;6541.786707784563
11
+ 2020-06-01;1220.0236666666667;6670.899239709285
12
+ 2020-07-01;1731.5539777777776;6880.257062804495
13
+ 2020-08-01;2012.7762555555555;6859.994191302926
14
+ 2020-09-01;2566.6432800000002;6650.605461375102
15
+ 2020-10-01;2838.76117;7109.852838006651
16
+ 2020-11-01;2925.1163727272724;7113.3090297969875
17
+ 2020-12-01;3206.5506090909093;7197.972073541302
18
+ 2021-01-01;3183.832609090909;6374.009481095359
19
+ 2021-02-01;3562.052745454545;7011.995289620221
20
+ 2021-03-01;3242.5764750000003;7282.817007379381
21
+ 2021-04-01;3452.8987454545454;7897.530131607511
22
+ 2021-05-01;3260.101309090909;7500.698636152339
23
+ 2021-06-01;2785.2703090909094;7954.630801419836
24
+ 2021-07-01;2385.9406833333337;7258.247057883863
25
+ 2021-08-01;2321.3464;7534.222846892518
26
+ 2021-09-01;2294.8570999999997;6536.559231045296
27
+ 2021-10-01;3017.342372727273;7027.180461980301
28
+ 2021-11-01;2935.186718181818;7523.51279634985
29
+ 2021-12-01;2575.5009750000004;7459.715436564322
30
+ 2022-01-01;2873.6602461538464;7050.156843690086
31
+ 2022-02-01;2754.920866666667;6949.758834627189
32
+ 2022-03-01;3379.66115;7032.027423804479
33
+ 2022-04-01;3286.3523099999998;7692.4848674508
34
+ 2022-05-01;2847.9890818181816;7462.713414643129
35
+ 2022-06-01;2899.5531545454546;7658.313830664824
36
+ 2022-07-01;3286.186963636363;7667.218777734914
37
+ 2022-08-01;3657.71656;7143.871781123152
38
+ 2022-09-01;3827.83348;7530.285881422287
get_forecast.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from dateutil.relativedelta import relativedelta
3
+ import matplotlib.pyplot as plt
4
+ from prophet.serialize import model_from_json
5
+
6
+ def get_forecast(serie: str, periods, percent_change: int):
7
+
8
+ if serie == 'SOM':
9
+ model_file, data_file = 'som_model.json', 'som_data.csv'
10
+ elif serie == 'Volumen':
11
+ model_file, data_file = 'volumen_model.json', 'volumen_data.csv'
12
+ else:
13
+ raise ValueError('Input not valid')
14
+
15
+ # load model files
16
+ with open(model_file, 'r') as fin:
17
+ model = model_from_json(fin.read())
18
+ history = pd.read_csv(data_file, encoding = 'utf-8-sig', sep = ';')
19
+ history['ds'] = pd.to_datetime(history['ds'])
20
+
21
+ # make future dataframe
22
+ future = model.make_future_dataframe(periods = periods, freq = 'MS')
23
+ future = future.tail(periods)
24
+
25
+ # filter prices last year
26
+ last_year_dates = future.ds.apply(lambda x: x - relativedelta(years=1))
27
+ past_prices = history[history['ds'].isin(last_year_dates)]['precio_hl'].values
28
+
29
+ # generate new_prices
30
+
31
+ percent_change = percent_change / 100
32
+
33
+ new_prices = past_prices * (1 + percent_change)
34
+
35
+ future['precio_hl'] = new_prices
36
+
37
+ forecast = model.predict(future)
38
+
39
+ future_values = forecast[['ds', 'yhat']]
40
+
41
+ last_obs = history.iloc[-1:][['ds', 'y']].rename(columns = {'y': 'yhat'})
42
+ future_aux = pd.concat([last_obs, future_values])
43
+
44
+ fig = plt.figure()
45
+ #plt.plot(history['ds'], history['y'], label = 'Historic data', marker = '.', color = 'C0')
46
+ plt.plot(future_aux['ds'], future_aux['yhat'], label = 'Forecast', marker = '.', color = 'C1')
47
+ plt.plot(history['ds'], history['y'], label = 'Historic data', marker = '.', color = 'C0')
48
+ plt.xticks(rotation = 45)
49
+ #plt.xlabel('Date')
50
+ plt.ylabel(serie)
51
+ plt.tight_layout()
52
+ plt.legend()
53
+
54
+ return fig
models/som_model.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"growth": "linear", "n_changepoints": 25, "specified_changepoints": false, "changepoint_range": 0.8, "yearly_seasonality": "auto", "weekly_seasonality": "auto", "daily_seasonality": "auto", "seasonality_mode": "additive", "seasonality_prior_scale": 10.0, "changepoint_prior_scale": 0.05, "holidays_prior_scale": 10.0, "mcmc_samples": 0, "interval_width": 0.8, "uncertainty_samples": 1000, "y_scale": 0.034426844435406806, "logistic_floor": false, "country_holidays": null, "component_modes": {"additive": ["yearly", "precio_hl", "additive_terms", "extra_regressors_additive", "holidays"], "multiplicative": ["multiplicative_terms", "extra_regressors_multiplicative"]}, "changepoints": "{\"name\":\"ds\",\"index\":[1,2,3,4,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,24,25,26,27,28],\"data\":[\"2019-10-01T00:00:00.000\",\"2019-11-01T00:00:00.000\",\"2019-12-01T00:00:00.000\",\"2020-01-01T00:00:00.000\",\"2020-03-01T00:00:00.000\",\"2020-04-01T00:00:00.000\",\"2020-05-01T00:00:00.000\",\"2020-06-01T00:00:00.000\",\"2020-07-01T00:00:00.000\",\"2020-08-01T00:00:00.000\",\"2020-09-01T00:00:00.000\",\"2020-10-01T00:00:00.000\",\"2020-12-01T00:00:00.000\",\"2021-01-01T00:00:00.000\",\"2021-02-01T00:00:00.000\",\"2021-03-01T00:00:00.000\",\"2021-04-01T00:00:00.000\",\"2021-05-01T00:00:00.000\",\"2021-06-01T00:00:00.000\",\"2021-07-01T00:00:00.000\",\"2021-09-01T00:00:00.000\",\"2021-10-01T00:00:00.000\",\"2021-11-01T00:00:00.000\",\"2021-12-01T00:00:00.000\",\"2022-01-01T00:00:00.000\"]}", "history_dates": "{\"name\":\"ds\",\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],\"data\":[\"2019-09-01T00:00:00.000\",\"2019-10-01T00:00:00.000\",\"2019-11-01T00:00:00.000\",\"2019-12-01T00:00:00.000\",\"2020-01-01T00:00:00.000\",\"2020-02-01T00:00:00.000\",\"2020-03-01T00:00:00.000\",\"2020-04-01T00:00:00.000\",\"2020-05-01T00:00:00.000\",\"2020-06-01T00:00:00.000\",\"2020-07-01T00:00:00.000\",\"2020-08-01T00:00:00.000\",\"2020-09-01T00:00:00.000\",\"2020-10-01T00:00:00.000\",\"2020-11-01T00:00:00.000\",\"2020-12-01T00:00:00.000\",\"2021-01-01T00:00:00.000\",\"2021-02-01T00:00:00.000\",\"2021-03-01T00:00:00.000\",\"2021-04-01T00:00:00.000\",\"2021-05-01T00:00:00.000\",\"2021-06-01T00:00:00.000\",\"2021-07-01T00:00:00.000\",\"2021-08-01T00:00:00.000\",\"2021-09-01T00:00:00.000\",\"2021-10-01T00:00:00.000\",\"2021-11-01T00:00:00.000\",\"2021-12-01T00:00:00.000\",\"2022-01-01T00:00:00.000\",\"2022-02-01T00:00:00.000\",\"2022-03-01T00:00:00.000\",\"2022-04-01T00:00:00.000\",\"2022-05-01T00:00:00.000\",\"2022-06-01T00:00:00.000\",\"2022-07-01T00:00:00.000\",\"2022-08-01T00:00:00.000\",\"2022-09-01T00:00:00.000\"]}", "train_holiday_names": null, "start": 1567296000.0, "t_scale": 94694400.0, "holidays": null, "history": "{\"schema\":{\"fields\":[{\"name\":\"ds\",\"type\":\"datetime\"},{\"name\":\"y\",\"type\":\"number\"},{\"name\":\"precio_hl\",\"type\":\"number\"},{\"name\":\"floor\",\"type\":\"integer\"},{\"name\":\"t\",\"type\":\"number\"},{\"name\":\"y_scaled\",\"type\":\"number\"}],\"pandas_version\":\"1.4.0\"},\"data\":[{\"ds\":\"2019-09-01T00:00:00.000\",\"y\":0.0209156533,\"precio_hl\":0.4383736274,\"floor\":0,\"t\":0.0,\"y_scaled\":0.6075390761},{\"ds\":\"2019-10-01T00:00:00.000\",\"y\":0.0205814925,\"precio_hl\":1.162364969,\"floor\":0,\"t\":0.0273722628,\"y_scaled\":0.5978326758},{\"ds\":\"2019-11-01T00:00:00.000\",\"y\":0.0209288085,\"precio_hl\":0.7924534116,\"floor\":0,\"t\":0.0556569343,\"y_scaled\":0.6079211963},{\"ds\":\"2019-12-01T00:00:00.000\",\"y\":0.0187544257,\"precio_hl\":0.2101784669,\"floor\":0,\"t\":0.0830291971,\"y_scaled\":0.5447616816},{\"ds\":\"2020-01-01T00:00:00.000\",\"y\":0.0230244724,\"precio_hl\":0.0306212724,\"floor\":0,\"t\":0.1113138686,\"y_scaled\":0.6687941584},{\"ds\":\"2020-02-01T00:00:00.000\",\"y\":0.0228063376,\"precio_hl\":0.39526479,\"floor\":0,\"t\":0.1395985401,\"y_scaled\":0.6624579722},{\"ds\":\"2020-03-01T00:00:00.000\",\"y\":0.0228061502,\"precio_hl\":0.9498293453,\"floor\":0,\"t\":0.1660583942,\"y_scaled\":0.6624525307},{\"ds\":\"2020-04-01T00:00:00.000\",\"y\":0.0248185671,\"precio_hl\":-1.4650651604,\"floor\":0,\"t\":0.1943430657,\"y_scaled\":0.7209074051},{\"ds\":\"2020-05-01T00:00:00.000\",\"y\":0.0274311269,\"precio_hl\":-1.7155502958,\"floor\":0,\"t\":0.2217153285,\"y_scaled\":0.7967946924},{\"ds\":\"2020-06-01T00:00:00.000\",\"y\":0.0265393519,\"precio_hl\":-1.3921877411,\"floor\":0,\"t\":0.25,\"y_scaled\":0.7708912137},{\"ds\":\"2020-07-01T00:00:00.000\",\"y\":0.0344268444,\"precio_hl\":-0.8678507189,\"floor\":0,\"t\":0.2773722628,\"y_scaled\":1.0},{\"ds\":\"2020-08-01T00:00:00.000\",\"y\":0.0343885576,\"precio_hl\":-0.9185991148,\"floor\":0,\"t\":0.3056569343,\"y_scaled\":0.9988878786},{\"ds\":\"2020-09-01T00:00:00.000\",\"y\":0.0321436074,\"precio_hl\":-1.4430135433,\"floor\":0,\"t\":0.3339416058,\"y_scaled\":0.9336785848},{\"ds\":\"2020-10-01T00:00:00.000\",\"y\":0.0301030867,\"precio_hl\":-0.2928277113,\"floor\":0,\"t\":0.3613138686,\"y_scaled\":0.8744073758},{\"ds\":\"2020-11-01T00:00:00.000\",\"y\":0.0265525762,\"precio_hl\":-0.2841716731,\"floor\":0,\"t\":0.3895985401,\"y_scaled\":0.7712753424},{\"ds\":\"2020-12-01T00:00:00.000\",\"y\":0.0273404781,\"precio_hl\":-0.0721329368,\"floor\":0,\"t\":0.4169708029,\"y_scaled\":0.7941616078},{\"ds\":\"2021-01-01T00:00:00.000\",\"y\":0.026089987,\"precio_hl\":-2.135748644,\"floor\":0,\"t\":0.4452554745,\"y_scaled\":0.757838467},{\"ds\":\"2021-02-01T00:00:00.000\",\"y\":0.02561241,\"precio_hl\":-0.5379121069,\"floor\":0,\"t\":0.473540146,\"y_scaled\":0.7439662384},{\"ds\":\"2021-03-01T00:00:00.000\",\"y\":0.0224023363,\"precio_hl\":0.1403613436,\"floor\":0,\"t\":0.4990875912,\"y_scaled\":0.6507229069},{\"ds\":\"2021-04-01T00:00:00.000\",\"y\":0.0248839981,\"precio_hl\":1.6799114036,\"floor\":0,\"t\":0.5273722628,\"y_scaled\":0.7228079856},{\"ds\":\"2021-05-01T00:00:00.000\",\"y\":0.0237630461,\"precio_hl\":0.6860462516,\"floor\":0,\"t\":0.5547445255,\"y_scaled\":0.6902475799},{\"ds\":\"2021-06-01T00:00:00.000\",\"y\":0.0236867115,\"precio_hl\":1.8229201277,\"floor\":0,\"t\":0.5830291971,\"y_scaled\":0.6880302821},{\"ds\":\"2021-07-01T00:00:00.000\",\"y\":0.0203186623,\"precio_hl\":0.0788258635,\"floor\":0,\"t\":0.6104014599,\"y_scaled\":0.5901982202},{\"ds\":\"2021-08-01T00:00:00.000\",\"y\":0.0196891274,\"precio_hl\":0.7700076941,\"floor\":0,\"t\":0.6386861314,\"y_scaled\":0.5719120551},{\"ds\":\"2021-09-01T00:00:00.000\",\"y\":0.0194523953,\"precio_hl\":-1.7286425202,\"floor\":0,\"t\":0.6669708029,\"y_scaled\":0.5650356764},{\"ds\":\"2021-10-01T00:00:00.000\",\"y\":0.023854423,\"precio_hl\":-0.499880817,\"floor\":0,\"t\":0.6943430657,\"y_scaled\":0.6929018152},{\"ds\":\"2021-11-01T00:00:00.000\",\"y\":0.0230812505,\"precio_hl\":0.7431843544,\"floor\":0,\"t\":0.7226277372,\"y_scaled\":0.670443397},{\"ds\":\"2021-12-01T00:00:00.000\",\"y\":0.0200434098,\"precio_hl\":0.5834037589,\"floor\":0,\"t\":0.75,\"y_scaled\":0.5822029322},{\"ds\":\"2022-01-01T00:00:00.000\",\"y\":0.0201922528,\"precio_hl\":-0.4423364301,\"floor\":0,\"t\":0.7782846715,\"y_scaled\":0.5865263918},{\"ds\":\"2022-02-01T00:00:00.000\",\"y\":0.0218090511,\"precio_hl\":-0.6937834137,\"floor\":0,\"t\":0.8065693431,\"y_scaled\":0.6334896918},{\"ds\":\"2022-03-01T00:00:00.000\",\"y\":0.0230171215,\"precio_hl\":-0.4877415929,\"floor\":0,\"t\":0.8321167883,\"y_scaled\":0.6685806333},{\"ds\":\"2022-04-01T00:00:00.000\",\"y\":0.0264868288,\"precio_hl\":1.1663751925,\"floor\":0,\"t\":0.8604014599,\"y_scaled\":0.7693655693},{\"ds\":\"2022-05-01T00:00:00.000\",\"y\":0.0234976055,\"precio_hl\":0.5909122,\"floor\":0,\"t\":0.8877737226,\"y_scaled\":0.6825373004},{\"ds\":\"2022-06-01T00:00:00.000\",\"y\":0.0234591622,\"precio_hl\":1.080793773,\"floor\":0,\"t\":0.9160583942,\"y_scaled\":0.6814206341},{\"ds\":\"2022-07-01T00:00:00.000\",\"y\":0.0233123925,\"precio_hl\":1.103096228,\"floor\":0,\"t\":0.9434306569,\"y_scaled\":0.6771574014},{\"ds\":\"2022-08-01T00:00:00.000\",\"y\":0.0271159762,\"precio_hl\":-0.2076272107,\"floor\":0,\"t\":0.9717153285,\"y_scaled\":0.7876404776},{\"ds\":\"2022-09-01T00:00:00.000\",\"y\":0.0280641849,\"precio_hl\":0.7601475575,\"floor\":0,\"t\":1.0,\"y_scaled\":0.8151831911}]}", "train_component_cols": "{\"schema\":{\"fields\":[{\"name\":\"additive_terms\",\"type\":\"integer\"},{\"name\":\"extra_regressors_additive\",\"type\":\"integer\"},{\"name\":\"precio_hl\",\"type\":\"integer\"},{\"name\":\"yearly\",\"type\":\"integer\"},{\"name\":\"multiplicative_terms\",\"type\":\"integer\"}],\"pandas_version\":\"1.4.0\"},\"data\":[{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":1,\"precio_hl\":1,\"yearly\":0,\"multiplicative_terms\":0}]}", "changepoints_t": [0.02737226277372263, 0.055656934306569344, 0.08302919708029197, 0.11131386861313869, 0.16605839416058393, 0.19434306569343066, 0.22171532846715328, 0.25, 0.2773722627737226, 0.3056569343065693, 0.33394160583941607, 0.3613138686131387, 0.416970802919708, 0.44525547445255476, 0.47354014598540145, 0.4990875912408759, 0.5273722627737226, 0.5547445255474452, 0.583029197080292, 0.6104014598540146, 0.666970802919708, 0.6943430656934306, 0.7226277372262774, 0.75, 0.7782846715328468], "seasonalities": [["yearly"], {"yearly": {"period": 365.25, "fourier_order": 10, "prior_scale": 10.0, "mode": "additive", "condition_name": null}}], "extra_regressors": [["precio_hl"], {"precio_hl": {"prior_scale": 10.0, "standardize": "auto", "mu": 7226.773386395456, "std": 399.28102386270757, "mode": "additive"}}], "fit_kwargs": {}, "params": {"lp__": [[71.1189]], "k": [[0.0095662]], "m": [[0.745678]], "delta": [[5.52743e-10, -2.41911e-10, -4.086e-10, 9.19514e-11, 5.14592e-10, 2.81605e-10, -1.01419e-09, -6.85263e-10, -4.26841e-11, -1.86213e-08, -1.53187e-05, -1.42724e-09, -0.000121743, -1.05024e-09, 4.24914e-10, -3.18284e-11, 3.81797e-11, -3.93796e-10, 2.26512e-10, -5.3171e-10, 5.76511e-10, 7.43769e-10, 4.12244e-10, 8.77491e-10, 9.04302e-11]], "sigma_obs": [[0.0885994]], "beta": [[0.0177307, -0.0386553, 0.248261, -0.199688, -0.56936, -0.030792, -0.27958, 0.122895, -0.445443, 0.680636, 0.391277, 0.0784374, -0.296242, -0.722254, -0.243212, -0.152836, -0.561712, -0.12267, 0.174095, 0.237231, -0.0650317]], "trend": [[0.745678, 0.74594, 0.74621, 0.746472, 0.746743, 0.747013, 0.747266, 0.747537, 0.747799, 0.748069, 0.748331, 0.748602, 0.748872, 0.749134, 0.749404, 0.749665, 0.749932, 0.750199, 0.75044, 0.750706, 0.750964, 0.751231, 0.751489, 0.751756, 0.752023, 0.752281, 0.752547, 0.752805, 0.753072, 0.753339, 0.75358, 0.753846, 0.754105, 0.754371, 0.754629, 0.754896, 0.755163]]}, "__prophet_version": "1.1.4"}
models/volumen_model.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"growth": "linear", "n_changepoints": 25, "specified_changepoints": false, "changepoint_range": 0.8, "yearly_seasonality": "auto", "weekly_seasonality": "auto", "daily_seasonality": "auto", "seasonality_mode": "additive", "seasonality_prior_scale": 10.0, "changepoint_prior_scale": 0.05, "holidays_prior_scale": 10.0, "mcmc_samples": 0, "interval_width": 0.8, "uncertainty_samples": 1000, "y_scale": 3827.83348, "logistic_floor": false, "country_holidays": null, "component_modes": {"additive": ["yearly", "precio_hl", "additive_terms", "extra_regressors_additive", "holidays"], "multiplicative": ["multiplicative_terms", "extra_regressors_multiplicative"]}, "changepoints": "{\"name\":\"ds\",\"index\":[1,2,3,4,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,24,25,26,27,28],\"data\":[\"2019-10-01T00:00:00.000\",\"2019-11-01T00:00:00.000\",\"2019-12-01T00:00:00.000\",\"2020-01-01T00:00:00.000\",\"2020-03-01T00:00:00.000\",\"2020-04-01T00:00:00.000\",\"2020-05-01T00:00:00.000\",\"2020-06-01T00:00:00.000\",\"2020-07-01T00:00:00.000\",\"2020-08-01T00:00:00.000\",\"2020-09-01T00:00:00.000\",\"2020-10-01T00:00:00.000\",\"2020-12-01T00:00:00.000\",\"2021-01-01T00:00:00.000\",\"2021-02-01T00:00:00.000\",\"2021-03-01T00:00:00.000\",\"2021-04-01T00:00:00.000\",\"2021-05-01T00:00:00.000\",\"2021-06-01T00:00:00.000\",\"2021-07-01T00:00:00.000\",\"2021-09-01T00:00:00.000\",\"2021-10-01T00:00:00.000\",\"2021-11-01T00:00:00.000\",\"2021-12-01T00:00:00.000\",\"2022-01-01T00:00:00.000\"]}", "history_dates": "{\"name\":\"ds\",\"index\":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],\"data\":[\"2019-09-01T00:00:00.000\",\"2019-10-01T00:00:00.000\",\"2019-11-01T00:00:00.000\",\"2019-12-01T00:00:00.000\",\"2020-01-01T00:00:00.000\",\"2020-02-01T00:00:00.000\",\"2020-03-01T00:00:00.000\",\"2020-04-01T00:00:00.000\",\"2020-05-01T00:00:00.000\",\"2020-06-01T00:00:00.000\",\"2020-07-01T00:00:00.000\",\"2020-08-01T00:00:00.000\",\"2020-09-01T00:00:00.000\",\"2020-10-01T00:00:00.000\",\"2020-11-01T00:00:00.000\",\"2020-12-01T00:00:00.000\",\"2021-01-01T00:00:00.000\",\"2021-02-01T00:00:00.000\",\"2021-03-01T00:00:00.000\",\"2021-04-01T00:00:00.000\",\"2021-05-01T00:00:00.000\",\"2021-06-01T00:00:00.000\",\"2021-07-01T00:00:00.000\",\"2021-08-01T00:00:00.000\",\"2021-09-01T00:00:00.000\",\"2021-10-01T00:00:00.000\",\"2021-11-01T00:00:00.000\",\"2021-12-01T00:00:00.000\",\"2022-01-01T00:00:00.000\",\"2022-02-01T00:00:00.000\",\"2022-03-01T00:00:00.000\",\"2022-04-01T00:00:00.000\",\"2022-05-01T00:00:00.000\",\"2022-06-01T00:00:00.000\",\"2022-07-01T00:00:00.000\",\"2022-08-01T00:00:00.000\",\"2022-09-01T00:00:00.000\"]}", "train_holiday_names": null, "start": 1567296000.0, "t_scale": 94694400.0, "holidays": null, "history": "{\"schema\":{\"fields\":[{\"name\":\"ds\",\"type\":\"datetime\"},{\"name\":\"y\",\"type\":\"number\"},{\"name\":\"precio_hl\",\"type\":\"number\"},{\"name\":\"floor\",\"type\":\"integer\"},{\"name\":\"t\",\"type\":\"number\"},{\"name\":\"y_scaled\",\"type\":\"number\"}],\"pandas_version\":\"1.4.0\"},\"data\":[{\"ds\":\"2019-09-01T00:00:00.000\",\"y\":2158.4562666667,\"precio_hl\":0.4383736274,\"floor\":0,\"t\":0.0,\"y_scaled\":0.563884578},{\"ds\":\"2019-10-01T00:00:00.000\",\"y\":2150.84358,\"precio_hl\":1.162364969,\"floor\":0,\"t\":0.0273722628,\"y_scaled\":0.5618958064},{\"ds\":\"2019-11-01T00:00:00.000\",\"y\":1605.3423333333,\"precio_hl\":0.7924534116,\"floor\":0,\"t\":0.0556569343,\"y_scaled\":0.4193866692},{\"ds\":\"2019-12-01T00:00:00.000\",\"y\":1728.7750285714,\"precio_hl\":0.2101784669,\"floor\":0,\"t\":0.0830291971,\"y_scaled\":0.4516327676},{\"ds\":\"2020-01-01T00:00:00.000\",\"y\":2948.4458538462,\"precio_hl\":0.0306212724,\"floor\":0,\"t\":0.1113138686,\"y_scaled\":0.7702649212},{\"ds\":\"2020-02-01T00:00:00.000\",\"y\":2742.9243846154,\"precio_hl\":0.39526479,\"floor\":0,\"t\":0.1395985401,\"y_scaled\":0.7165735915},{\"ds\":\"2020-03-01T00:00:00.000\",\"y\":2622.6981461538,\"precio_hl\":0.9498293453,\"floor\":0,\"t\":0.1660583942,\"y_scaled\":0.6851651619},{\"ds\":\"2020-04-01T00:00:00.000\",\"y\":1036.413325,\"precio_hl\":-1.4650651604,\"floor\":0,\"t\":0.1943430657,\"y_scaled\":0.2707571608},{\"ds\":\"2020-05-01T00:00:00.000\",\"y\":1110.5237666667,\"precio_hl\":-1.7155502958,\"floor\":0,\"t\":0.2217153285,\"y_scaled\":0.2901180975},{\"ds\":\"2020-06-01T00:00:00.000\",\"y\":1220.0236666667,\"precio_hl\":-1.3921877411,\"floor\":0,\"t\":0.25,\"y_scaled\":0.3187243314},{\"ds\":\"2020-07-01T00:00:00.000\",\"y\":1731.5539777778,\"precio_hl\":-0.8678507189,\"floor\":0,\"t\":0.2773722628,\"y_scaled\":0.4523587525},{\"ds\":\"2020-08-01T00:00:00.000\",\"y\":2012.7762555556,\"precio_hl\":-0.9185991148,\"floor\":0,\"t\":0.3056569343,\"y_scaled\":0.5258264933},{\"ds\":\"2020-09-01T00:00:00.000\",\"y\":2566.64328,\"precio_hl\":-1.4430135433,\"floor\":0,\"t\":0.3339416058,\"y_scaled\":0.6705211429},{\"ds\":\"2020-10-01T00:00:00.000\",\"y\":2838.76117,\"precio_hl\":-0.2928277113,\"floor\":0,\"t\":0.3613138686,\"y_scaled\":0.7416104135},{\"ds\":\"2020-11-01T00:00:00.000\",\"y\":2925.1163727273,\"precio_hl\":-0.2841716731,\"floor\":0,\"t\":0.3895985401,\"y_scaled\":0.7641702253},{\"ds\":\"2020-12-01T00:00:00.000\",\"y\":3206.5506090909,\"precio_hl\":-0.0721329368,\"floor\":0,\"t\":0.4169708029,\"y_scaled\":0.837693339},{\"ds\":\"2021-01-01T00:00:00.000\",\"y\":3183.8326090909,\"precio_hl\":-2.135748644,\"floor\":0,\"t\":0.4452554745,\"y_scaled\":0.8317583891},{\"ds\":\"2021-02-01T00:00:00.000\",\"y\":3562.0527454545,\"precio_hl\":-0.5379121069,\"floor\":0,\"t\":0.473540146,\"y_scaled\":0.9305662757},{\"ds\":\"2021-03-01T00:00:00.000\",\"y\":3242.576475,\"precio_hl\":0.1403613436,\"floor\":0,\"t\":0.4990875912,\"y_scaled\":0.8471048942},{\"ds\":\"2021-04-01T00:00:00.000\",\"y\":3452.8987454545,\"precio_hl\":1.6799114036,\"floor\":0,\"t\":0.5273722628,\"y_scaled\":0.9020504062},{\"ds\":\"2021-05-01T00:00:00.000\",\"y\":3260.1013090909,\"precio_hl\":0.6860462516,\"floor\":0,\"t\":0.5547445255,\"y_scaled\":0.8516831587},{\"ds\":\"2021-06-01T00:00:00.000\",\"y\":2785.2703090909,\"precio_hl\":1.8229201277,\"floor\":0,\"t\":0.5830291971,\"y_scaled\":0.7276362265},{\"ds\":\"2021-07-01T00:00:00.000\",\"y\":2385.9406833333,\"precio_hl\":0.0788258635,\"floor\":0,\"t\":0.6104014599,\"y_scaled\":0.6233136044},{\"ds\":\"2021-08-01T00:00:00.000\",\"y\":2321.3464,\"precio_hl\":0.7700076941,\"floor\":0,\"t\":0.6386861314,\"y_scaled\":0.6064387106},{\"ds\":\"2021-09-01T00:00:00.000\",\"y\":2294.8571,\"precio_hl\":-1.7286425202,\"floor\":0,\"t\":0.6669708029,\"y_scaled\":0.5995185297},{\"ds\":\"2021-10-01T00:00:00.000\",\"y\":3017.3423727273,\"precio_hl\":-0.499880817,\"floor\":0,\"t\":0.6943430657,\"y_scaled\":0.7882637498},{\"ds\":\"2021-11-01T00:00:00.000\",\"y\":2935.1867181818,\"precio_hl\":0.7431843544,\"floor\":0,\"t\":0.7226277372,\"y_scaled\":0.7668010465},{\"ds\":\"2021-12-01T00:00:00.000\",\"y\":2575.500975,\"precio_hl\":0.5834037589,\"floor\":0,\"t\":0.75,\"y_scaled\":0.672835166},{\"ds\":\"2022-01-01T00:00:00.000\",\"y\":2873.6602461538,\"precio_hl\":-0.4423364301,\"floor\":0,\"t\":0.7782846715,\"y_scaled\":0.7507276012},{\"ds\":\"2022-02-01T00:00:00.000\",\"y\":2754.9208666667,\"precio_hl\":-0.6937834137,\"floor\":0,\"t\":0.8065693431,\"y_scaled\":0.7197076051},{\"ds\":\"2022-03-01T00:00:00.000\",\"y\":3379.66115,\"precio_hl\":-0.4877415929,\"floor\":0,\"t\":0.8321167883,\"y_scaled\":0.8829174957},{\"ds\":\"2022-04-01T00:00:00.000\",\"y\":3286.35231,\"precio_hl\":1.1663751925,\"floor\":0,\"t\":0.8604014599,\"y_scaled\":0.8585410852},{\"ds\":\"2022-05-01T00:00:00.000\",\"y\":2847.9890818182,\"precio_hl\":0.5909122,\"floor\":0,\"t\":0.8877737226,\"y_scaled\":0.7440211537},{\"ds\":\"2022-06-01T00:00:00.000\",\"y\":2899.5531545455,\"precio_hl\":1.080793773,\"floor\":0,\"t\":0.9160583942,\"y_scaled\":0.7574919781},{\"ds\":\"2022-07-01T00:00:00.000\",\"y\":3286.1869636364,\"precio_hl\":1.103096228,\"floor\":0,\"t\":0.9434306569,\"y_scaled\":0.8584978894},{\"ds\":\"2022-08-01T00:00:00.000\",\"y\":3657.71656,\"precio_hl\":-0.2076272107,\"floor\":0,\"t\":0.9717153285,\"y_scaled\":0.95555791},{\"ds\":\"2022-09-01T00:00:00.000\",\"y\":3827.83348,\"precio_hl\":0.7601475575,\"floor\":0,\"t\":1.0,\"y_scaled\":1.0}]}", "train_component_cols": "{\"schema\":{\"fields\":[{\"name\":\"additive_terms\",\"type\":\"integer\"},{\"name\":\"extra_regressors_additive\",\"type\":\"integer\"},{\"name\":\"precio_hl\",\"type\":\"integer\"},{\"name\":\"yearly\",\"type\":\"integer\"},{\"name\":\"multiplicative_terms\",\"type\":\"integer\"}],\"pandas_version\":\"1.4.0\"},\"data\":[{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":0,\"precio_hl\":0,\"yearly\":1,\"multiplicative_terms\":0},{\"additive_terms\":1,\"extra_regressors_additive\":1,\"precio_hl\":1,\"yearly\":0,\"multiplicative_terms\":0}]}", "changepoints_t": [0.02737226277372263, 0.055656934306569344, 0.08302919708029197, 0.11131386861313869, 0.16605839416058393, 0.19434306569343066, 0.22171532846715328, 0.25, 0.2773722627737226, 0.3056569343065693, 0.33394160583941607, 0.3613138686131387, 0.416970802919708, 0.44525547445255476, 0.47354014598540145, 0.4990875912408759, 0.5273722627737226, 0.5547445255474452, 0.583029197080292, 0.6104014598540146, 0.666970802919708, 0.6943430656934306, 0.7226277372262774, 0.75, 0.7782846715328468], "seasonalities": [["yearly"], {"yearly": {"period": 365.25, "fourier_order": 10, "prior_scale": 10.0, "mode": "additive", "condition_name": null}}], "extra_regressors": [["precio_hl"], {"precio_hl": {"prior_scale": 10.0, "standardize": "auto", "mu": 7226.773386395456, "std": 399.28102386270757, "mode": "additive"}}], "fit_kwargs": {}, "params": {"lp__": [[68.3812]], "k": [[0.35688]], "m": [[0.509584]], "delta": [[-7.583e-10, 3.31218e-11, 3.44581e-10, -4.11189e-10, -8.80571e-10, 4.92288e-10, -4.06167e-10, -3.82032e-10, -1.53223e-06, -0.000211749, -5.01742e-09, -2.26916e-05, -0.000138296, -0.000150756, -4.47882e-05, -1.97857e-05, -4.8733e-05, -0.000160277, -4.04954e-06, -8.05248e-10, -4.11235e-10, 6.61211e-10, 4.05217e-10, 3.97487e-10, -3.12213e-10]], "sigma_obs": [[0.0953287]], "beta": [[-0.00861773, 0.0596922, -0.0397192, 0.795943, 0.0435506, -0.472443, -0.139883, 0.136953, -0.444732, -0.241488, 0.218099, 0.0457034, -0.445245, 0.169349, -0.136084, -0.118595, -0.0722461, 0.565728, 0.044623, -0.765886, 0.0796917]], "trend": [[0.509584, 0.519352, 0.529447, 0.539215, 0.549309, 0.559404, 0.568847, 0.578941, 0.58871, 0.598804, 0.608572, 0.618667, 0.628755, 0.638518, 0.648605, 0.658367, 0.668451, 0.67853, 0.687633, 0.697711, 0.707462, 0.717533, 0.72728, 0.737352, 0.747423, 0.75717, 0.767241, 0.776988, 0.787059, 0.797131, 0.806228, 0.816299, 0.826046, 0.836118, 0.845864, 0.855936, 0.866007]]}, "__prophet_version": "1.1.4"}