Project Information
- Category: Regression / ML
- Tools: Python, Flask, CatBoost, XGBoost
- Best R² Score: 0.9792 (CatBoost Regressor)
- Project URL: View on GitHub
Diamond Price Prediction 💎📈
This project builds a regression model to accurately predict diamond prices based on various features such as carat, cut, color, and clarity.
📌 Problem Statement
Predict the price of diamonds using multiple features for improved valuation and pricing decisions.
📊 Data Collection
Dataset: Kaggle - Playground Series Season 3 Episode 8
🧬 Features
- carat: Weight of the diamond
- cut: Quality of the diamond cut
- color: Diamond color grade (D–J)
- clarity: Purity level based on internal flaws
- depth, table, x, y, z: Physical dimensions
- price: Target variable
📈 Model Performance Comparison
Model | MSE | RMSE | MAE | Train R² | Test R² | Adj. R² |
---|---|---|---|---|---|---|
CatBoost Regressor | 3.36e+05 | 579.96 | 295.48 | 0.9827 | 0.9792 | 0.9792 |
XGBRegressor | 3.42e+05 | 585.44 | 296.96 | 0.9838 | 0.9788 | 0.9788 |
Random Forest | 3.71e+05 | 609.35 | 310.42 | 0.9968 | 0.9770 | 0.9770 |
KNN Regressor | 4.49e+05 | 670.78 | 350.55 | 0.9815 | 0.9722 | 0.9721 |
Decision Tree | 7.00e+05 | 837.25 | 422.66 | 1.0000 | 0.9566 | 0.9566 |
Linear Regression | 1.01e+06 | 1006.60 | 671.58 | 0.9366 | 0.9373 | 0.9373 |
Ridge | 1.01e+06 | 1006.60 | 671.61 | 0.9366 | 0.9373 | 0.9373 |
Lasso | 1.01e+06 | 1006.87 | 672.99 | 0.9366 | 0.9373 | 0.9372 |
AdaBoost | 1.94e+06 | 1393.41 | 971.55 | 0.8827 | 0.8798 | 0.8798 |
🏆 Best Model: CatBoost Regressor
Achieved highest R² and lowest error metrics across all models.
🔍 Insights & Findings
- Tree-based models outperform linear models significantly.
- CatBoost and XGBoost showed the best test-time performance.
- Decision Tree overfitted; Lasso/Ridge failed to capture nonlinearities.
📓 Notebooks
🛠️ How to Run
git clone https://github.com/Mazenasag/Gemstone_Price_Prediction_.git
cd diamond-price-prediction
# Run the Flask app
python app.py
Then open your browser and visit: http://127.0.0.1:5000/
✍️ Author
Developed by Mazen Asag