← Back to selected work

Laptop Price Predictor

View on GitHub

Predicts laptop prices from hardware specifications, benchmarking ten regression models by cross-validated accuracy before picking Gradient Boosting as the best performer. Wrapped in a Streamlit app for interactive price estimation.

PythonScikit-learnXGBoostStreamlit
The problem

Laptop prices depend on a large combination of specifications (brand, CPU, RAM, storage type and size, GPU, screen properties) that don't map to price in an obvious linear way. The goal was a model that predicts price directly from those specs, wrapped in an app a non-technical user could actually use to get an estimate.

The approach

Ten regression algorithms, spanning linear models, tree-based models, boosting methods, and instance-based methods, were trained on the same cleaned dataset and evaluated with five-fold cross-validation rather than a single train and test split, so the comparison reflects consistency across folds, not a lucky split. The best-performing model by cross-validated R-squared was then wrapped in a Streamlit app that takes the same specification fields as dropdown inputs and returns a live price estimate.

Results
0.744
R-squared, Gradient Boosting, the best of 10 models
$237
mean absolute error, Gradient Boosting
10
regression algorithms benchmarked
1,281
laptops in the training and test set combined
Stack
PythonScikit-learnXGBoostPandasStreamlit
👋 Hi, I'm a digital version of Lasantha. Ask me about my work.