Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,10 +1,86 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title: Store Sales
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
|
|
|
|
|
|
| 7 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
title: Store Sales Time Series Forecasting
|
| 4 |
+
emoji: 📈
|
| 5 |
+
colorFrom: blue
|
| 6 |
+
colorTo: green
|
| 7 |
sdk: docker
|
| 8 |
+
sdk_version: 1
|
| 9 |
+
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
+
short_description: Forecast store sales over 13 weeks using LSTM
|
| 12 |
+
license: mit
|
| 13 |
+
tags:
|
| 14 |
+
- time-series
|
| 15 |
+
- forecasting
|
| 16 |
+
- lstm
|
| 17 |
+
- retail
|
| 18 |
+
- pytorch
|
| 19 |
+
library_name: pytorch
|
| 20 |
+
model-index:
|
| 21 |
+
- name: ImprovedCashFlowLSTM
|
| 22 |
+
results:
|
| 23 |
+
- task:
|
| 24 |
+
type: time-series-forecasting
|
| 25 |
+
dataset:
|
| 26 |
+
name: Kaggle Store Sales
|
| 27 |
+
type: store-sales-time-series-forecasting
|
| 28 |
+
metrics:
|
| 29 |
+
- name: MAE
|
| 30 |
+
type: mae
|
| 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
|