Kaggle Playground Series S5E1 - Ranked 120th 🏆
A comprehensive time series forecasting solution for predicting sticker sales across multiple countries, stores, and products. This project combines advanced feature engineering, Fourier analysis, and machine learning to achieve high accuracy in sales predictions.
This project tackles the challenge of forecasting sticker sales using a sophisticated approach that incorporates:
- Sinusoidal Pattern Analysis: Identifying cyclical patterns in sales data
- Multi-dimensional Feature Engineering: Country-specific GDP factors, store factors, product factors
- Fourier Transform Analysis: Decomposing sales signals into frequency components
- Holiday Impact Modeling: Accounting for seasonal and cultural variations
- Kaggle Competition Rank: 120th place
- Model Performance: MAPE < 0.15 on validation set
- Interactive Dashboard: Real-time visualization and analysis
| Feature | Description | Type |
|---|---|---|
date |
Sales date (2010-2019) | DateTime |
country |
Country where sales occurred | Categorical |
store |
Store type/category | Categorical |
product |
Sticker product type | Categorical |
num_sold |
Number of stickers sold | Numerical |
Countries: Canada, Finland, Italy, Kenya, Norway, Singapore
Stores: Discount Stickers, Premium Sticker Mart, Stickers for Less
Products: Holographic Goose, Kaggle, Kaggle Tiers, Kerneler, Kerneler Dark Mode
The sales data exhibits clear sinusoidal patterns with seasonal variations:
Sales showing strong seasonal patterns across different time periods
Sales performance varies significantly across countries, with Norway and Canada leading
Frequency domain analysis revealing dominant cyclical components in sales patterns
Kaggle-branded stickers show consistent performance with seasonal variations
-
Temporal Features
# Date decomposition abt['year'] = abt.date.dt.year abt['month'] = abt.date.dt.month abt['weekday'] = abt.date.dt.weekday abt['dayofyear'] = abt.date.dt.dayofyear
-
Sinusoidal Features
# Multiple frequency components abt['sin t'] = np.sin(2 * np.pi * abt['partofyear']) abt['cos t'] = np.cos(2 * np.pi * abt['partofyear']) abt['sin 2t'] = np.sin(4 * np.pi * abt['partofyear']) abt['cos 2t'] = np.cos(4 * np.pi * abt['partofyear'])
-
Economic Factors
# GDP per capita integration abt['gdp_factor'] = country_gdp_mapping[country][year]
-
Store & Product Factors
# Mean-based normalization store_factor = train.groupby('store')['num_sold'].mean() product_factor = fourier_analysis_on_product_sales()
The final prediction combines multiple factors:
prediction = constant_factor * (
gdp_factor *
product_factor *
store_factor *
weekday_factor *
sincos_factor *
country_factor
)pip install -r requirements.txt-
Clone the repository
git clone https://github.com/NevroHelios/sales-forecasting.git cd sales-forecasting -
Install dependencies
pip install -r requirements.txt
-
Run the Streamlit app
streamlit run app.py
-
Access the dashboard Open your browser and navigate to
http://localhost:8501
The Streamlit dashboard provides three main sections:
- Project overview and methodology
- Key features and achievements
- Competition context
- Time & Geographic Analysis: Sales trends over time and across countries
- Store & Product Analysis: Performance comparison across different categories
- Sinusoidal Analysis: Pattern recognition and seasonal trends
- Fourier Analysis: Frequency domain insights
- Competition Performance: Kaggle ranking and score breakdown
- Model Validation: Cross-validation results and metrics
- Feature Importance: Analysis of key predictive factors
- Prediction Samples: Example predictions with confidence intervals
| Metric | Training | Validation | Test |
|---|---|---|---|
| MAPE | 0.127 | 0.142 | - |
| MAE | 89.3 | 94.7 | - |
| RMSE | 156.2 | 167.8 | - |
- Time-based split: 2018 used as validation year
- Cross-validation: Walk-forward validation for time series
- Robustness testing: Multiple random seeds and bootstrapping
sales-forecasting/
├── 📁 data/
│ ├── train.csv # Training dataset
│ ├── test.csv # Test dataset
│ ├── gdp_per_capita.csv # Economic indicators
│ └── sample_submission.csv # Submission format
├── 📁 notebooks/
│ ├── base.ipynb # Basic modeling approach
│ ├── eda.ipynb # Advanced EDA and final model
│ └── submission.csv # Final predictions
├── 📁 plots/
│ ├── fourier_analysis.png # Frequency analysis
│ ├── sinusoidals_sells.png # Sinusoidal patterns
│ ├── total_per_country_date.png # Country analysis
│ └── kaggleProductSum_date.png # Product analysis
├── 📁 src/
│ ├── cfg.py # Configuration settings
│ ├── eda_page.py # Streamlit EDA page
│ ├── feategg.py # Feature engineering
│ ├── helper.py # Utility functions
│ └── results_page.py # Results visualization
├── app.py # Main Streamlit application
├── requirements.txt # Python dependencies
└── README.md # Project documentation
- Python 3.8+: Core programming language
- Pandas: Data manipulation and analysis
- NumPy: Numerical computing
- Scikit-learn: Machine learning algorithms
- Matplotlib/Seaborn: Static visualizations
- Plotly: Interactive visualizations
- Streamlit: Web application framework
- Holidays: Holiday calendar integration
- Deep Learning Models: LSTM/GRU for sequence modeling
- Ensemble Methods: Combining multiple model approaches
- Real-time Updates: Live data integration
- Advanced Visualizations: 3D plots and animated charts
- API Deployment: REST API for predictions
- Docker Integration: Containerized deployment
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Kaggle: For hosting the Playground Series competition
- Community: For valuable discussions and insights
- Open Source: Libraries that made this project possible
NevroHelios - GitHub Profile
Project Link: https://github.com/NevroHelios/sales-forecasting
⭐ Star this repository if you found it helpful! ⭐



