ā¢8 min read
How I Built a Dynamic Pricing ML System
Introduction
A Dynamic Pricing ML System that predicts optimal prices for retail products to maximize sales revenue. Built with LightGBM, Flask, and a beautiful web UI.
šÆ What Does This Project Do?
Given a product (identified by stockcode), this system predicts:
- How many units will sell at different price points
- What is the optimal price to maximize total revenue
Business Question:
"If I price product X at $Y, how many will I sell and what's my revenue?"
⨠Key Features
| Feature | Description |
|---|---|
| š¤ ML Models | LightGBM + ElasticNet ensemble for robust predictions |
| š REST API | Flask-based API with CORS support |
| šØ Web UI | Beautiful, responsive prediction interface |
| š Visualizations | Interactive charts showing price vs. sales curves |
| š Production Ready | Docker support for AWS Lambda/SageMaker deployment |
| ā” Fast Inference | ~1-2 seconds per prediction |
šļø System Architecture
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Raw Data āāāāāāā Data Pipeline āāāāāāā Processed Data ā
ā (CSV/Excel) ā ā (Engineering) ā ā (Parquet) ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā
ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Predictions āāāāāāā Flask API āāāāāāā ML Models ā
ā (JSON/UI) ā ā (Waitress) ā ā (LightGBM) ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāQuick Start
bash
# Clone the repository
git clone https://github.com/danishsyed-dev/ml-sales-prediction.git
cd ml-sales-prediction
# Install dependencies
pip install -r requirements.txt
# Run the application
python application.py