# AI-Based Diamond Price Prediction and Classification This project aims to predict diamond grading prices, GIA-certified prices, and classification-based changes in diamond attributes using machine learning models. The system processes diamond attributes from engineer plans and provides AI-driven insights into pricing and parameter variations. --- ## 🚀 Project Overview The goal of this project is to develop an AI-driven pipeline for automating diamond grading and certification price predictions. The system leverages machine learning models to analyze historical diamond data, predict pricing estimates, and provide classification-based recommendations. ### 🔹 Features: - Predict **GIA-certified prices** and **grading prices** for diamonds. - Classify and recommend **potential changes in diamond parameters**. - Analyze **historical data trends** for better forecasting. - Provide **real-time AI predictions via a web-based interface**. --- ## 📌 Problem Statement Diamond pricing and grading involve complex, time-consuming manual evaluations. This project automates the process by utilizing **machine learning models** to predict pricing, detect parameter changes, and generate valuable insights for decision-making. --- ## ⚙️ Tech Stack | Component | Tools & Technologies | |-----------------|---------------------| | **Data Collection** | Python (Requests, SQL) | | **Data Preprocessing** | Pandas, NumPy, Scikit-learn Pipelines | | **Model Development** | Scikit-learn, XGBoost, LightGBM, TensorFlow/PyTorch | | **Model Evaluation** | Scikit-learn metrics (RMSE, MAE, R²), Evidently, Prometheus | | **Deployment** | Flask, FastAPI, Docker | --- ## 🛠 Setup & Installation ### 1️⃣ Create a Virtual Environment ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` ### 2️⃣ Install Dependencies ```bash pip install -r requirements.txt ``` ### 3️⃣ Run the Application ```bash python app.py ``` OR (if using Docker) ```bash docker-compose up --build ``` --- ## 📊 Application Workflow ### **🔹 Prediction Module** **Input:** Diamond parameters from engineer plans: `Tag, EngCts, EngShp, EngQua, EngCol, EngCut, EngPol, EngSym, EngFlo, EngNts, EngMikly, EngLab, EngAmt` **Process:** 1. **Historical Learning:** AI model learns from past diamond data. 2. **Training:** Identifies patterns linking diamond attributes to final pricing. 3. **Deployment:** Predicts `GrdAmt, ByGrdAmt, GiaAmt` for new inputs. **Output:** - AI-generated price estimates with **>95% accuracy**. --- ### **🔹 Classification Module** **Input:** Engineer Plan data with additional attributes: `Tag, EngCts, EngShp, EngQua, EngCol, EngCut, EngPol, EngSym, EngFlo, EngNts, EngMikly, EngLab, EngAmt, Carat, Black_Code, White_Code` **Process:** 1. **AI Model Training:** Learns from past cases where Carat, Black_Code, or White_Code led to different outcomes. 2. **Alert Generation:** Detects discrepancies in new inputs and suggests corrections. **Output:** - **Alerts and recommendations** for potential adjustments in diamond parameters. --- ## 📂 App Structure ``` . ├── app.py # Flask application ├── templates/ │ ├── index.html # Home page │ ├── output.html # Prediction result display ├── uploads/ # Uploaded diamond datasets ├── Model/ # Trained AI models (joblib) ├── Label_encoders/ # Encoders for categorical variables ├── requirements.txt # Dependencies ├── Dockerfile # Containerization setup ├── README.md # Documentation ``` --- ## 🌟 Key Features ✔ **GIA Price Prediction** – Estimates diamond grading costs. ✔ **Parameter Classification** – Identifies changes in carat, shape, and other factors. ✔ **Real-time AI Predictions** – Instant price estimates based on historical data. ✔ **User-friendly Web Interface** – Upload diamond data and get instant insights. ✔ **Downloadable Reports** – Export predictions and analysis as CSV files. --- ## 🛠 API Endpoints | Endpoint | Method | Description | |----------|--------|-------------