M5 Dataset Model
M5 Dataset Model
USING M5 DATASET.
df_sample = df_sales.iloc[3, :]
series_sample = df_sample.iloc[6:]
df_sample
STEP 5 : SUMMARIZE THE SALES DATA BY GROUPING IT BY STORE_ID AND CALCULATING
THE TOTAL SALES FOR EACH STORE ACROSS ALL PRODUCTS AND TIME PERIODS.
df_sales_total_by_store = df_sales.groupby(['store_id']).sum()
df_store_sales = df_sales_total_by_store.iloc[:,5:]
df_store_sales
STEP 6 : PROCESSING DATA AND CHECKING WHEATHER DATA IS STATIONARY OR NON
STATIONARY
HYPER PARAMETERS
window_size = 365 (1 YEAR == 365 DAYS )
prediction_horizon = 1 -ONE STEP FORECASTING HENCE PREDICTION
HORIZON=1
TRAIN TEST SPLIT
test_size = 28
split_time = len(series) - test_size
train_series = series[:split_time]
test_series = series[split_time - window_size:]
train_y = train_y.flatten()
test_y = test_y.flatten()
In recursive forecasting, we first train a one-step model then generate a multi-step forecast by
recursively feeding our predictions back into the model.
plt.rcParams['figure.figsize'] = [5, 5]
lgb.plot_importance(model, max_num_features = 15, importance_type = 'split')
pl.show()
LightGBM provides feature importance scores, which help identify the most influential features in
the model.
CONCLUSION OF THIS MODEL (KEY TAKE AWAYS ):
Share accurate demand forecasts with suppliers and distributors to reduce information
asymmetry.
This helps align orders with actual consumer demand, minimizing amplification
Use forecasts to adjust inventory levels dynamically, avoiding overstocking or stockouts.
Use multi-step forecasts to plan production and delivery schedules in advance.
4Shorter lead times reduce the need for large safety stocks, which can amplify the bullwhip
effect.