Spaces:
Sleeping
Sleeping
Upload 26 files
Browse files- app.py +1 -1
- config.py +2 -0
- maps/date_models_test/fixed_columns.parquet +2 -2
- maps/date_models_test/shift_features.parquet +3 -0
- maps/date_models_test/unique_products.parquet +2 -2
- models/date_models_test/CATBOOST_FOLD_1.pkl +2 -2
- models/date_models_test/CATBOOST_FOLD_2.pkl +2 -2
- models/date_models_test/CATBOOST_FOLD_3.pkl +2 -2
- models/date_models_test/CATBOOST_FOLD_4.pkl +2 -2
- models/date_models_test/CATBOOST_FOLD_5.pkl +2 -2
- pipeline.py +4 -1
- src/data/__pycache__/load_data.cpython-311.pyc +0 -0
- src/data/load_data.py +1 -1
- src/features/__pycache__/build_features.cpython-311.pyc +0 -0
- src/features/build_features.py +42 -1
- src/utils/__pycache__/mail.cpython-311.pyc +0 -0
app.py
CHANGED
@@ -79,7 +79,7 @@ def main():
|
|
79 |
input_save = st.checkbox(config['SAVE_CHECKBOX_TEXT'])
|
80 |
confirm_params = {
|
81 |
'input_save':input_save,
|
82 |
-
'send_mail':
|
83 |
'email_adress': st.session_state["text_input"],
|
84 |
'forecast_start_date':st.session_state["input_date"][0].strftime("%Y/%m/%d"),
|
85 |
'forecast_end_date':st.session_state["input_date"][1].strftime("%Y/%m/%d")
|
|
|
79 |
input_save = st.checkbox(config['SAVE_CHECKBOX_TEXT'])
|
80 |
confirm_params = {
|
81 |
'input_save':input_save,
|
82 |
+
'send_mail':do_mail_sending,
|
83 |
'email_adress': st.session_state["text_input"],
|
84 |
'forecast_start_date':st.session_state["input_date"][0].strftime("%Y/%m/%d"),
|
85 |
'forecast_end_date':st.session_state["input_date"][1].strftime("%Y/%m/%d")
|
config.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from dotenv import load_dotenv
|
2 |
import os
|
3 |
|
|
|
1 |
+
# tahmin çıktılarında date kolonu sadece yyyy/mm/dd şeklinde yap
|
2 |
+
|
3 |
from dotenv import load_dotenv
|
4 |
import os
|
5 |
|
maps/date_models_test/fixed_columns.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b157854e71f088b326d9b7a8cca4c23c2d2be8d29c6a34b84247036cbc35b915
|
3 |
+
size 14494
|
maps/date_models_test/shift_features.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e4cce186c59cdf90f2a5cb6195c39f98e5924eb55fd88c8f0361b462d3bd7002
|
3 |
+
size 6894627
|
maps/date_models_test/unique_products.parquet
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f6566704cf5202f8b6cce4d6aa1d9ab8241056dab9b4089312ccf1c4404bf4d1
|
3 |
+
size 9184
|
models/date_models_test/CATBOOST_FOLD_1.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:359f951663f6be9fd14557cae7aa8b33e63dbd0069528322473b82d167ddbe07
|
3 |
+
size 5168328
|
models/date_models_test/CATBOOST_FOLD_2.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:646a2e501cdf4a9338587e1046240b9c059f7d5c0e7349aac1358460de74e05f
|
3 |
+
size 4778571
|
models/date_models_test/CATBOOST_FOLD_3.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5addc4fd7536e8a2cdc9d126ea9852ac12dad193aca2ab4bc6bf2e01d7c9ed95
|
3 |
+
size 5385151
|
models/date_models_test/CATBOOST_FOLD_4.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8d75b9a3e480d90945cfe0d6310759c4bb36612b337db94a69802998d40794d5
|
3 |
+
size 241036
|
models/date_models_test/CATBOOST_FOLD_5.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:afd6bc4b286114d33acdbecbb2ba04cc846c0fb2f4c7154e4fd1e08dc4ce3f55
|
3 |
+
size 77265
|
pipeline.py
CHANGED
@@ -27,7 +27,10 @@ def run(forecast_start_date, forecast_end_date):
|
|
27 |
|
28 |
dataframe = prepare_data(
|
29 |
dataframe=pd.concat([generated_test], axis=0),
|
30 |
-
|
|
|
|
|
|
|
31 |
)
|
32 |
|
33 |
dataframe[config['target']] = np.nan
|
|
|
27 |
|
28 |
dataframe = prepare_data(
|
29 |
dataframe=pd.concat([generated_test], axis=0),
|
30 |
+
data=None,
|
31 |
+
split_local_test=config['split_local_test'],
|
32 |
+
add_datetime_features=True,
|
33 |
+
add_lag_features=True
|
34 |
)
|
35 |
|
36 |
dataframe[config['target']] = np.nan
|
src/data/__pycache__/load_data.cpython-311.pyc
CHANGED
Binary files a/src/data/__pycache__/load_data.cpython-311.pyc and b/src/data/__pycache__/load_data.cpython-311.pyc differ
|
|
src/data/load_data.py
CHANGED
@@ -69,7 +69,7 @@ def get_data(
|
|
69 |
y_test = generated_test[target]
|
70 |
generated_test.drop(target, axis=1, inplace=True)
|
71 |
|
72 |
-
return generated_train, generated_test, y_test
|
73 |
|
74 |
def split_train_test(dataframe):
|
75 |
|
|
|
69 |
y_test = generated_test[target]
|
70 |
generated_test.drop(target, axis=1, inplace=True)
|
71 |
|
72 |
+
return dataframe, generated_train, generated_test, y_test
|
73 |
|
74 |
def split_train_test(dataframe):
|
75 |
|
src/features/__pycache__/build_features.cpython-311.pyc
CHANGED
Binary files a/src/features/__pycache__/build_features.cpython-311.pyc and b/src/features/__pycache__/build_features.cpython-311.pyc differ
|
|
src/features/build_features.py
CHANGED
@@ -1,6 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
def prepare_data(
|
2 |
dataframe,
|
3 |
-
|
|
|
|
|
|
|
4 |
):
|
5 |
|
6 |
print('Building features...')
|
@@ -8,6 +17,38 @@ def prepare_data(
|
|
8 |
if add_datetime_features:
|
9 |
dataframe = datetime_features(dataframe)
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
return dataframe
|
12 |
|
13 |
def datetime_features(dataframe, date='date', suffix=''):
|
|
|
1 |
+
import pandas as pd
|
2 |
+
from src.utils.helper_functions import save_parquet, load_parquet
|
3 |
+
from config import Config
|
4 |
+
|
5 |
+
config = vars(Config)
|
6 |
+
|
7 |
def prepare_data(
|
8 |
dataframe,
|
9 |
+
data,
|
10 |
+
split_local_test,
|
11 |
+
add_datetime_features=True,
|
12 |
+
add_lag_features=True
|
13 |
):
|
14 |
|
15 |
print('Building features...')
|
|
|
17 |
if add_datetime_features:
|
18 |
dataframe = datetime_features(dataframe)
|
19 |
|
20 |
+
if add_lag_features:
|
21 |
+
dataframe = lag_features(dataframe, data, split_local_test)
|
22 |
+
|
23 |
+
|
24 |
+
return dataframe
|
25 |
+
|
26 |
+
def lag_features(dataframe, data, split_local_test):
|
27 |
+
|
28 |
+
if split_local_test:
|
29 |
+
|
30 |
+
backlog_cols = [col for col in data.columns if col.endswith('_backlog')]
|
31 |
+
|
32 |
+
lag_backlog_cols = []
|
33 |
+
for col in backlog_cols:
|
34 |
+
for shift in range(9,13,1):
|
35 |
+
|
36 |
+
shift_col_name = f'{col}_shift_{shift}'
|
37 |
+
data.loc[:, shift_col_name] = data.groupby('product_id')[col].shift(shift)
|
38 |
+
|
39 |
+
lag_backlog_cols.append(shift_col_name)
|
40 |
+
|
41 |
+
save_parquet(
|
42 |
+
dataframe=data[lag_backlog_cols + ['product_id','date']],
|
43 |
+
path=f'{config["fold_input_directory"]}/shift_features.parquet'
|
44 |
+
)
|
45 |
+
|
46 |
+
map_data = data[lag_backlog_cols + ['product_id','date']]
|
47 |
+
else:
|
48 |
+
map_data = load_parquet(f'{config["fold_input_directory"]}/shift_features.parquet')
|
49 |
+
|
50 |
+
dataframe = pd.merge(dataframe, map_data, how='left', on=['product_id','date'])
|
51 |
+
|
52 |
return dataframe
|
53 |
|
54 |
def datetime_features(dataframe, date='date', suffix=''):
|
src/utils/__pycache__/mail.cpython-311.pyc
CHANGED
Binary files a/src/utils/__pycache__/mail.cpython-311.pyc and b/src/utils/__pycache__/mail.cpython-311.pyc differ
|
|