Time series data, collected at regular intervals, is crucial for businesses to understand past trends and forecast future outcomes. Accurate time series forecasting enables organizations to make data-driven decisions and optimize operations across various domains, including supply chain management, financial forecasting, weather prediction, and sales analysis.
This project utilizes cutting-edge tools such as Greykite, a Python library developed by LinkedIn, and Neural Prophet, a deep-learning-based model developed by Facebook, to predict store sales. The solution also integrates Flask for web deployment, making forecasts easily accessible to end users.
The goal is to develop an accurate time series forecasting solution that leverages historical data to predict future sales trends using Greykite and Neural Prophet, with an accessible deployment interface via Flask.
This project uses Walmart store sales data, which contains detailed sales records for 45 Walmart stores in different regions. The dataset includes:
- Stores.csv: Information about each store, including store type and size.
- Train.csv: Historical sales data spanning from 2010-02-05 to 2012-11-01.
- Test.csv: Similar to Train.csv but excludes weekly sales, which need to be predicted.
- Features.csv: Supplementary data related to stores, departments, and regional activities.
- Store: Unique identifier for stores.
- Date: Weekly sales data timestamps.
- Department: Identifier for store departments.
- Temperature: Average regional temperature.
- Fuel Price: Weekly fuel prices.
- MarkDown1-5: Anonymized promotional markdown data.
- CPI: Consumer Price Index.
- Unemployment: Regional unemployment rate.
- IsHoliday: Indicator for special holiday weeks.
- Weekly Sales: Target variable for predictions.
- Programming Language: Python
- Libraries:
Greykite
andNeural Prophet
for advanced time series forecasting.Pandas
andNumPy
for efficient data handling.Matplotlib
,Seaborn
, andPlotly
for interactive visualizations.Pandas-Profiling
for automated exploratory data analysis.Sci-kit Learn
for preprocessing and metrics.Flask
for web-based deployment.
- Analyze dataset features using
Pandas-Profiling
. - Visualize data trends, seasonality, and anomalies.
- Handle missing data and outliers.
- Normalize numerical features and encode categorical variables.
- Extract date components (day, month, year, week).
- Engineer features based on domain-specific knowledge.
- Decompose time series into trend, seasonality, and residuals.
- Train forecasting models with:
- Greykite: Provides interpretable and scalable forecasting solutions.
- Neural Prophet: Combines deep learning with time series methodologies.
- Assess model performance using metrics:
- Mean Absolute Percent Error (MAPE)
- Root Mean Squared Error (RMSE)
- Generate weekly sales forecasts for departments and stores.
- Develop a Flask-based web application for real-time predictions.
.
├── input/ # Data files (stores.csv, train.csv, test.csv, features.csv).
├── src/ # Core project folder.
│ ├── engine.py # Main script for model training and evaluation.
│ ├── server.py # Flask app for deployment.
│ ├── ML_Pipeline/ # Modular scripts for preprocessing and modeling.
│ ├── data_processing.py # Data cleaning utilities.
│ ├── forecasting_models.py # Greykite and Neural Prophet implementations.
│ ├── feature_engineering.py # Feature extraction and engineering.
├── output/ # Results and saved models.
├── lib/ # Reference materials and notebooks.
├── requirements.txt # List of dependencies.
└── README.md # Project documentation.
git clone <repository_url>
cd <repository_folder>
Install the required libraries with:
pip install -r requirements.txt
- Train models and generate forecasts:
python src/engine.py
- Deploy the Flask application:
python src/server.py
Navigate to http://127.0.0.1:5000
in your browser to interact with the web-based forecasting tool.
- Accurate Forecasts:
- Models effectively predict sales trends and seasonality.
- Interactive Visualizations:
- Visualizations provide actionable insights for business decision-making.
- Scalable Deployment:
- Flask application ensures easy integration into business workflows.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature"
- Push your branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.
For any questions or suggestions, please reach out to:
- Name: Abhinav Navneet
- Email: [email protected]
- GitHub: AjNavneet
Special thanks to:
- Greykite for its powerful forecasting library.
- Neural Prophet for deep-learning forecasting capabilities.
- The Python open-source community for exceptional tools and support.