Spaces:
Running
Running
Commit
·
57b2558
1
Parent(s):
496f54b
v1.1 release fix
Browse files
app.py
CHANGED
@@ -124,8 +124,7 @@ def get_forecast_period(period):
|
|
124 |
|
125 |
# SARIMAX Model
|
126 |
@st.cache_data
|
127 |
-
def train_test(dataframe):
|
128 |
-
n = round(len(dataframe) * 0.2)
|
129 |
training_y = dataframe.iloc[:-n,0]
|
130 |
test_y = dataframe.iloc[-n:,0]
|
131 |
test_y_series = pd.Series(test_y, index=dataframe.iloc[-n:, 0].index)
|
@@ -303,8 +302,6 @@ with st.sidebar:
|
|
303 |
df = date_format(df)
|
304 |
merge_sort(df)
|
305 |
series = group_to_three(df)
|
306 |
-
print(series) # debug
|
307 |
-
print(len(series)) # debug
|
308 |
|
309 |
st.session_state.uploaded = True
|
310 |
|
@@ -328,13 +325,14 @@ if (st.session_state.uploaded):
|
|
328 |
|
329 |
if (forecast_button or st.session_state.forecasted):
|
330 |
df = series_to_df_exogenous(series)
|
|
|
|
|
|
|
331 |
|
332 |
-
train = train_test(df)
|
333 |
training_y, test_y, test_y_series, training_X, test_X, future_X = train
|
334 |
train_test_model = test_fitting(df, training_X, training_y)
|
335 |
|
336 |
-
n_periods = round(len(df) * 0.2)
|
337 |
-
print(n_periods) # debug
|
338 |
future_n_periods = forecast_period
|
339 |
fitted, confint = train_test_model.predict(X=test_X, n_periods=n_periods, return_conf_int=True)
|
340 |
index_of_fc = test_y_series.index
|
|
|
124 |
|
125 |
# SARIMAX Model
|
126 |
@st.cache_data
|
127 |
+
def train_test(dataframe, n):
|
|
|
128 |
training_y = dataframe.iloc[:-n,0]
|
129 |
test_y = dataframe.iloc[-n:,0]
|
130 |
test_y_series = pd.Series(test_y, index=dataframe.iloc[-n:, 0].index)
|
|
|
302 |
df = date_format(df)
|
303 |
merge_sort(df)
|
304 |
series = group_to_three(df)
|
|
|
|
|
305 |
|
306 |
st.session_state.uploaded = True
|
307 |
|
|
|
325 |
|
326 |
if (forecast_button or st.session_state.forecasted):
|
327 |
df = series_to_df_exogenous(series)
|
328 |
+
print(df) # debug
|
329 |
+
print(len(df)) # debug
|
330 |
+
n_periods = round(len(df) * 0.2)
|
331 |
|
332 |
+
train = train_test(df, n_periods)
|
333 |
training_y, test_y, test_y_series, training_X, test_X, future_X = train
|
334 |
train_test_model = test_fitting(df, training_X, training_y)
|
335 |
|
|
|
|
|
336 |
future_n_periods = forecast_period
|
337 |
fitted, confint = train_test_model.predict(X=test_X, n_periods=n_periods, return_conf_int=True)
|
338 |
index_of_fc = test_y_series.index
|