CoolFace
Apppublic

EnYa32/TimeSeriesForecasting

sourceHugging Facemitupdated 9mo agoView on Hugging Face
0likes
App README

๐Ÿ“ˆ Sales Forecast (LightGBM)

This Streamlit app predicts `num_sold` using a trained LightGBM model with time-based features and lag features.

What it does

  • โ€”Takes calendar features (year/month/week/dayofweek/dayofyear, weekend)
  • โ€”Uses lag features (lag364, lag365, lag_371)
  • โ€”Uses categorical inputs (country/store/product) via saved encoders
  • โ€”Outputs a num_sold prediction

Files required (put in the repo root)

  • โ€”app.py
  • โ€”lgbm_model.pkl
  • โ€”feature_names.pkl (list of feature names in correct order)
  • โ€”encoders.pkl (dict of LabelEncoders for country, store, product)
  • โ€”fill_map.pkl (optional: medians for numeric feature filling)

How to save artifacts in your notebook (training side)

python
import joblib

joblib.dump(model_lgb, 'lgbm_model.pkl')
joblib.dump(FEATURES, 'feature_names.pkl')
joblib.dump(encoders, 'encoders.pkl')

# optional numeric medians for filling missing
num_cols = [c for c in FEATURES if c not in ['country', 'store', 'product']]
fill_map = train_fe[num_cols].median().to_dict()
joblib.dump(fill_map, 'fill_map.pkl')