This repository offers a powerful and flexible inventory optimization tool built around a Random Forest-based forecasting model. By analyzing historical sales or demand data, it enables businesses to predict future trends and optimize stock levels accordingly. Whether you're managing retail shelves, e-commerce inventory, or warehouse supplies, this tool provides data-driven insights to reduce stockouts and overstocking, ultimately improving operational efficiency and cost management.
At the heart of this project is a Streamlit-powered interactive dashboard that makes time series forecasting accessible even to non-technical users. From uploading data to generating multi-period forecasts, every step is streamlined with built-in automation and visualization tools. Users can select a target variable, process temporal features, train a predictive model, evaluate its performance, and export results—all within a single interface.
This solution is ideal for small to mid-sized businesses looking to introduce data-driven planning into their inventory or supply chain workflow without the need for complex infrastructure or external services.
- Interactive Dashboard: Built with Streamlit for a smooth and user-friendly experience
- Automated Time Series Feature Engineering: Extracts day, week, month, seasonality, and lag features from date columns
- Robust Forecasting Engine: Utilizes Random Forest Regression for reliable and explainable predictions
- Forecast Visualization: Visual comparison of historical and predicted data using Plotly charts
- Data Upload Support: Easily ingest custom datasets in CSV format
- Model Evaluation: Tracks accuracy using metrics like RMSE, MAE, R², and provides detailed error analysis
- Model Persistence: Save and reload models using pickle for repeatable workflows
- Downloadable Forecasts: Export results in CSV format for business reporting or integration
-
Language: Python
-
Frontend Framework: Streamlit
-
Machine Learning:
RandomForestRegressorfromsklearn.ensemble- Support for lag-based forecasting and statistical feature generation
-
Data Processing:
pandas,numpy,LabelEncoder- Automatic detection of date columns and feature transformations
-
Visualization:
Plotlyfor interactive time series and performance plotsSeaborn,matplotlibfor additional charting (optional)
-
Forecasting Logic:
- Dynamic feature building for future time points
- Sequential prediction loop to simulate realistic rolling forecasts
-
Model Variants:
- Additional notebooks (
.ipynb) included for experimenting with XGBoost and ensemble models
- Additional notebooks (
git clone https://github.com/your-username/inventory-forecasting-app.git
cd inventory-forecasting-apppip install -r requirements.txtstreamlit run app.py- Upload your CSV dataset
- Select the target column to forecast
- Prepare the data and train the model
- Review model performance and forecast results
- Download forecasted data as a CSV file
This project bridges the gap between data science and business operations by offering an intelligent inventory forecasting tool that’s as practical as it is insightful. With minimal setup, you can start optimizing your supply chain using proven machine learning techniques. It’s a great foundation for teams looking to enhance demand planning, reduce waste, and improve service levels—whether for internal decision-making or customer-facing logistics.
For extensions or deeper customization, the included notebooks provide a hands-on approach to refining and experimenting with advanced modeling techniques such as ensemble methods and gradient boosting.