This project predicts used car prices using a feedforward neural network regression model built in PyTorch.
- 📊 Neural Network Regression Model with Batch Normalization and Dropout for better training stability and generalization
- 🧩 Structured data preprocessing with numeric clipping, categorical encoding, and feature normalization
- ⚖️ Mean Squared Error (MSE) as the loss function
- 🧠 Adam optimizer for training
- 🔀 Train/Validation/Test split for robust evaluation
- 📈 Feature & target normalization using training statistics
- 💾 Saving/loading trained model and preprocessing artifacts for inference
- 🎨 Interactive Gradio Interface for real-time prediction
Below is a preview of the Gradio Interface used for real-time prediction:
- PyTorch – model, training, and inference
- pandas – data handling & preprocessing
- scikit-learn – ColumnTransformer, standardization, one-hot encoding
- matplotlib – plotting loss curves
- pickle – saving/loading feature transformer, statistics and trained model
- Gradio — interactive web interface for real-time model demos
- Python 3.13+
- Recommended editor: VS Code
- Clone the repository
git clone https://github.com/hurkanugur/Car-Price-Predictor.git- Navigate to the
Car-Price-Predictordirectory
cd Car_Price_Predictor- Install dependencies
pip install -r requirements.txtView → Command Palette → Python: Create Environment- Choose Venv and your Python version
- Select requirements.txt to install dependencies
- Click OK
assets/
└── app_screenshot.png # Screenshot of the application
data/
└── car_price_dataset.csv # Raw used car data
model/
├── car_price_model.pth # Trained PyTorch model
├── feature_transformer.pkl # Fitted preprocessing transformer
└── statistics.pkl # Preprocessing stats
src/
├── config.py # Paths, hyperparameters, split ratios
├── dataset.py # Data loading & preprocessing
├── device_manager.py # Selects and manages compute device
├── train.py # Training pipeline
├── inference.py # Inference pipeline
├── model.py # Neural network definition
└── visualize.py # Training/validation plots
main/
├── main_train.py # Entry point for training
└── main_inference.py # Entry point for inference
requirements.txt # Python dependenciesInput → Linear(256) → BatchNorm → ReLU → Dropout(0.2)
→ Linear(128) → BatchNorm → ReLU → Dropout(0.2)
→ Linear(64) → BatchNorm → ReLU → Dropout(0.1)
→ Linear(1) → OutputNavigate to the project directory:
cd Car_Price_PredictorRun the training script:
python -m main.main_trainor
python3 -m main.main_trainNavigate to the project directory:
cd Car_Price_PredictorRun the app:
python -m main.main_inferenceor
python3 -m main.main_inference