Chenhui/code improvments (#157)
* updated docstring
* pinged package versions
* minor improvements
* minor improvement
Former-commit-id: 43a423eacf
This commit is contained in:
Родитель
2657c1c7bb
Коммит
21c44cd709
|
@ -420,7 +420,7 @@ def specify_retail_data_schema(
|
|||
df (Pandas DataFrame): sales data combined with store demographic features
|
||||
"""
|
||||
# Read the 1st split of training data if "sales" is not specified
|
||||
if sales is None:
|
||||
if not sales:
|
||||
print("Sales dataframe is not given! The 1st split of training data will be used.")
|
||||
sales = pd.read_csv(os.path.join(data_dir, "train", "train_round_1.csv"), index_col=False)
|
||||
aux = pd.read_csv(os.path.join(data_dir, "train", "aux_round_1.csv"), index_col=False)
|
||||
|
|
|
@ -61,7 +61,7 @@ def day_type(datetime_col, holiday_col=None, semi_holiday_offset=timedelta(days=
|
|||
datetype = pd.DataFrame({"DayType": datetime_col.dt.dayofweek})
|
||||
datetype.replace({"DayType": WEEK_DAY_TYPE_MAP}, inplace=True)
|
||||
|
||||
if holiday_col is not None:
|
||||
if holiday_col:
|
||||
holiday_mask = holiday_col > 0
|
||||
datetype.loc[holiday_mask, "DayType"] = HOLIDAY_CODE
|
||||
|
||||
|
@ -606,7 +606,7 @@ def same_day_hour_moving_average(
|
|||
week_lag_start = start_week + i
|
||||
hour_lags = [(week_lag_start + w) * 24 * 7 for w in range(window_size)]
|
||||
hour_lags = [h for h in hour_lags if h > max_diff]
|
||||
if len(hour_lags) > 0:
|
||||
if hour_lags:
|
||||
tmp_df = df[["value"]].copy()
|
||||
tmp_col_all = []
|
||||
for h in hour_lags:
|
||||
|
@ -678,7 +678,7 @@ def same_day_hour_moving_quantile(
|
|||
week_lag_start = start_week + i
|
||||
hour_lags = [(week_lag_start + w) * 24 * 7 for w in range(window_size)]
|
||||
hour_lags = [h for h in hour_lags if h > max_diff]
|
||||
if len(hour_lags) > 0:
|
||||
if hour_lags:
|
||||
tmp_df = df[["value"]].copy()
|
||||
tmp_col_all = []
|
||||
for h in hour_lags:
|
||||
|
@ -749,7 +749,7 @@ def same_day_hour_moving_std(
|
|||
week_lag_start = start_week + i
|
||||
hour_lags = [(week_lag_start + w) * 24 * 7 for w in range(window_size)]
|
||||
hour_lags = [h for h in hour_lags if h > max_diff]
|
||||
if len(hour_lags) > 0:
|
||||
if hour_lags:
|
||||
tmp_df = df[["value"]].copy()
|
||||
tmp_col_all = []
|
||||
for h in hour_lags:
|
||||
|
@ -825,7 +825,7 @@ def same_day_hour_moving_agg(
|
|||
week_lag_start = start_week + i
|
||||
hour_lags = [(week_lag_start + w) * 24 * 7 for w in range(window_size)]
|
||||
hour_lags = [h for h in hour_lags if h > max_diff]
|
||||
if len(hour_lags) > 0:
|
||||
if hour_lags:
|
||||
tmp_df = df[["value"]].copy()
|
||||
tmp_col_all = []
|
||||
for h in hour_lags:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
pandas
|
||||
datetime
|
||||
scikit_learn
|
||||
numpy
|
||||
requests
|
||||
pandas==0.23.4
|
||||
datetime==4.3
|
||||
scikit-learn==0.20.3
|
||||
numpy==1.16.2
|
||||
requests==2.23.0
|
|
@ -1,11 +1,11 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
# To create the conda environment:
|
||||
# $ conda env create -f environment.yaml
|
||||
# $ conda env create -f environment.yml
|
||||
#
|
||||
# To update the conda environment:
|
||||
# $ conda env update -f environment.yaml
|
||||
# $ conda env update -f environment.yml
|
||||
#
|
||||
# To register the conda environment in Jupyter:
|
||||
# $ conda activate forecasting_env
|
||||
|
|
Загрузка…
Ссылка в новой задаче