2 min read
Car Price Prediction System
Predictive analytics web application leveraging machine learning models for automotive pricing.
Pythonscikit-learnFlaskData AnalysisNginx
Overview
A web application that predicts used car prices based on features like make, model, year, mileage, and condition. The project covers the full pipeline — data collection, cleaning, feature engineering, model training, and production deployment.
Pipeline
Raw Data
│
▼
Data Cleaning (missing values, outliers)
│
▼
Feature Engineering (encoding, scaling)
│
▼
Model Training (Linear Regression, Random Forest, XGBoost)
│
▼
Model Evaluation (RMSE, R²)
│
▼
Export to ONNX / Pickle
│
▼
Flask API + Web UI
│
▼
Nginx → Production
Models Compared
| Model | RMSE ($) | R² Score |
|---|---|---|
| Linear Regression | 3,842 | 0.82 |
| Random Forest | 2,156 | 0.91 |
| XGBoost | 1,893 | 0.93 |
XGBoost was chosen for production due to the best accuracy and reasonable inference time.
Deployment
Deployed on the same Linux VPS infrastructure as the Signature Detection System. Containerized with Docker behind Nginx reverse proxy:
# Build and run
docker build -t car-price-predictor .
docker run -d \
--name car-price-predictor \
-p 127.0.0.1:5001:5000 \
--restart unless-stopped \
car-price-predictor
Nginx config:
server {
listen 443 ssl http2;
server_name car.kushaltimilsina.com.np;
ssl_certificate /etc/letsencrypt/live/car.kushaltimilsina.com.np/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/car.kushaltimilsina.com.np/privkey.pem;
location / {
proxy_pass http://127.0.0.1:5001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Key Features
- Input vehicle details through a clean web form
- Real-time price prediction using the trained XGBoost model
- Confidence intervals shown alongside predictions
- Responsive design for mobile access