← Back to projects
Data Analytics 2023

Diamond Price Prediction

A linear regression model that predicts diamond prices from carat weight, tested against a held-out set of real diamonds to measure how much of the price variation it actually explains.

The Problem

Diamond pricing depends on several factors (carat, cut, color, clarity), but carat weight is typically the strongest driver of price. This project tests how well price can be predicted using carat alone, and quantifies how much of the price variation that one variable explains.

Approach

  1. Loaded the diamonds dataset (53,940 records) with carat, cut, color, clarity, depth, table, and price for each stone.
  2. Ran a correlation analysis to confirm carat as the strongest predictor of price relative to other numeric features.
  3. Split the data into training (67%) and test (33%) sets.
  4. Trained a linear regression model using carat as the sole input feature.
  5. Evaluated the model on the held-out test set and compared predicted vs. actual prices.

Results

0.848
R² Score
53,940
Diamonds Analyzed

The model explains about 85% of the variation in diamond price using carat weight alone. The chart below plots actual prices (blue) against predicted prices (orange) across the test set — the orange points tracking tightly along the diagonal shows the model's predictions closely following real prices as carat increases, with the expected wider spread at higher carats where other factors (cut, clarity, color) start to matter more.

Actual vs predicted diamond prices scatter plot
Correlation heatmap of diamond features vs price

Correlation heatmap confirming carat as the dominant predictor of price.

Tools

Pythonpandasseabornscikit-learn
View full code on GitHub →