All Projects
Time SeriesForecastingTabular
Store Sales Time Series Forecasting
Forecasting daily sales across 1,782 store × product time series
Predict daily sales for every store × product-family combination over a 16-day holdout window — Corporación Favorita's retail data, evaluated by RMSLE (root mean squared log error), which penalizes relative rather than absolute error so a miss on a slow-selling item counts as much as a miss on a bestseller.
Dataset
Source
Kaggle time-series forecasting competition — Corporación Favorita (Ecuadorian grocery retailer) daily sales, 2013–2017
- •3,000,888 train rows, 2013-01-01 to 2017-08-15 (~4.6 years daily)
- •28,512 test rows: 16-day forecast horizon (2017-08-16 to 2017-08-31)
- •54 stores × 33 product families = 1,782 individual time series
- •Auxiliary tables: store metadata (22 cities, 16 states, 5 store types, 17 clusters), daily oil price, national/bridge holidays, daily transactions per store
- •31.3% of rows have zero sales; sales are heavily right-skewed (median 11, mean 358, max 124,717)
Approach
- •LightGBM regression on log1p(sales) — turns RMSLE minimization into plain RMSE minimization
- •Lag features at 7/14/21/28/35/42/56 days per (store_nbr, family) group — multiples of 7 to align with weekly seasonality
- •Rolling mean (7/14/30-day) and rolling std (7-day), all shifted 7 days back before rolling to prevent leakage from the future
- •Promotion and transaction lag/rolling features, plus date features (day-of-week, week-of-year, is_weekend, is_month_start/end, is_payday for Ecuador's 15th/month-end paydays)
- •Oil price (Ecuador's economy is oil-dependent) and national/bridge holiday flags merged in as auxiliary signals
- •Categorical columns (family, city, state, store type) integer-encoded via pandas cat.codes — plain label encoding, not LightGBM's native categorical splits
Training
- •num_leaves=127, learning_rate=0.05, feature_fraction/bagging_fraction=0.8, min_child_samples=50
- •Validation: last 16 days of training data held out, matching the actual test horizon length — a time-based split, not random k-fold, to avoid leaking future information into training
- •Early stopping (patience 50 rounds) against validation RMSE, best iteration 1,187 of a 3,000-round budget
- •Final model retrained on the full training set using that fixed iteration count before predicting on the test period
Results
Validation RMSLE0.3793
- •Validation RMSLE: 0.37934
- •lag_7 (same weekday one week prior) dominates feature importance by a wide margin — gain of 122M, over 4× the next-highest feature (lag_7_roll3, a 3-week rolling average built on the same lag)
- •Weekly seasonality features (lag_7, lag_7_roll3, roll_mean_7) account for the vast majority of the model's predictive power; store transactions, product family, and oil price contribute meaningfully but far behind