sukhmani1303 commited on
Commit
114df8f
·
verified ·
1 Parent(s): ffb0b6b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +30 -25
README.md CHANGED
@@ -1,4 +1,3 @@
1
-
2
  ---
3
  title: Store Sales Time Series Forecasting
4
  emoji: 📈
@@ -31,56 +30,62 @@ model-index:
31
  value: 710.75
32
  - name: RMSE
33
  type: rmse
34
- value: 1108.51
35
  - name: MAPE
36
  type: mape
37
- value: 7.14
38
  - name: R2
39
  type: r2
40
  value: 0.8633
41
  ---
42
- # Store Sales Forecasting Model
43
- ## Model Overview
44
- This is an Improved Cash Flow LSTM model for forecasting store sales over a 13-week horizon, trained on the Kaggle Store Sales dataset.
 
 
45
  ## Model Architecture
46
  - **Type**: LSTM
47
- - **Input Size**: 20
48
  - **Hidden Size**: 128
49
  - **Number of Layers**: 2
50
  - **Dropout**: 0.2
51
  - **Forecast Horizon**: 13 weeks
52
- - **Parameters**: 227,085
53
- ## Features Used
54
- sales, onpromotion, trend, dayofweek_sin, dayofweek_cos, month_sin, month_cos, is_weekend, quarter, sales_lag_1, sales_lag_7, sales_lag_14, sales_ma_7, sales_ma_14, sales_ratio_7, sales_ratio_14, promo_lag_1, promo_running_sum, dcoilwtico, is_holiday
55
  ## Performance Metrics
56
  - **MAE**: $710.75
57
- - **RMSE**: $1108.51
58
- - **MAPE**: 7.14%
59
  - **R² Score**: 0.8633
 
60
  ## Usage
61
- 1. Install dependencies: `pip install -r requirements.txt`
62
- 2. Use `inference.py` to load the model and make predictions.
63
- 3. Input data must have 21 timesteps and match the feature set, scaled using `scaler.pkl`.
 
64
  ### Example
65
  ```python
66
- import numpy as np
67
- from inference import load_model_and_artifacts, forecast
68
- model, scaler, feature_names = load_model_and_artifacts()
69
- sequences = np.random.random((1, 21, len(feature_names))) # Replace with actual data
70
- predictions, uncertainties = forecast(model, scaler, sequences)
71
  print("Predictions:", predictions)
72
  ```
 
73
  ## Training Details
74
  - **Dataset**: Kaggle Store Sales Time Series Forecasting
75
  - **Data Shape**: (8250, 20)
76
  - **Sequences**: 8217, length 21
77
  - **Preprocessing**: StandardScaler, conservative outlier removal
78
- - **Epochs**: 107 (early stopping)
79
  - **Optimizer**: Adam with ReduceLROnPlateau
80
  - **Loss**: MSE
 
81
  ## Limitations
82
- - Predictions are sensitive to input data quality.
83
- - Model assumes consistent feature scaling.
84
- - Performance may degrade on sparse or outlier-heavy data.
 
85
  ## License
86
- MIT License
 
 
1
  ---
2
  title: Store Sales Time Series Forecasting
3
  emoji: 📈
 
30
  value: 710.75
31
  - name: RMSE
32
  type: rmse
33
+ value: 1108.36
34
  - name: MAPE
35
  type: mape
36
+ value: 7.16
37
  - name: R2
38
  type: r2
39
  value: 0.8633
40
  ---
41
+ # Store Sales Time Series Forecasting
42
+
43
+ ## Overview
44
+ This Hugging Face Space hosts an LSTM-based model (`ImprovedCashFlowLSTM`) for forecasting store sales over a 13-week horizon, trained on the Kaggle Store Sales Time Series Forecasting dataset.
45
+
46
  ## Model Architecture
47
  - **Type**: LSTM
48
+ - **Input Size**: 20 features
49
  - **Hidden Size**: 128
50
  - **Number of Layers**: 2
51
  - **Dropout**: 0.2
52
  - **Forecast Horizon**: 13 weeks
53
+ - **Parameters**: 227,441
54
+ - **Features**: sales, onpromotion, trend, dayofweek_sin, dayofweek_cos, month_sin, month_cos, is_weekend, quarter, sales_lag_1, sales_lag_7, sales_lag_14, sales_ma_7, sales_ma_14, sales_ratio_7, sales_ratio_14, promo_lag_1, promo_running_sum, dcoilwtico, is_holiday
55
+
56
  ## Performance Metrics
57
  - **MAE**: $710.75
58
+ - **RMSE**: $1108.36
59
+ - **MAPE**: 7.16%
60
  - **R² Score**: 0.8633
61
+
62
  ## Usage
63
+ 1. **Synthetic Data**: Click "Generate Synthetic Data" to create a 21-timestep sample dataset (sales ~$3,000–19,000) and view a 13-week forecast.
64
+ 2. **Custom Data**: Upload a CSV with 21 timesteps and 20 features matching the above feature names.
65
+ 3. **Output**: View forecasts in a table and Plotly graph with uncertainty bands.
66
+
67
  ### Example
68
  ```python
69
+ from inference import load_model_and_artifacts, predict
70
+ model, scaler, feature_names, config = load_model_and_artifacts()
71
+ sequences = scaler.transform(your_data[feature_names].values).reshape(1, 21, 20)
72
+ predictions, uncertainties = predict(model, scaler, sequences)
 
73
  print("Predictions:", predictions)
74
  ```
75
+
76
  ## Training Details
77
  - **Dataset**: Kaggle Store Sales Time Series Forecasting
78
  - **Data Shape**: (8250, 20)
79
  - **Sequences**: 8217, length 21
80
  - **Preprocessing**: StandardScaler, conservative outlier removal
81
+ - **Epochs**: 70 (early stopping)
82
  - **Optimizer**: Adam with ReduceLROnPlateau
83
  - **Loss**: MSE
84
+
85
  ## Limitations
86
+ - Predictions are sensitive to input data quality and scaling.
87
+ - Performance may degrade on low-sales stores (<$3,000) not included in training.
88
+ - Assumes consistent feature engineering as in training.
89
+
90
  ## License
91
+ MIT License