A University Project
Predicting Mobile Prices
2024


Ingredients
- Python
- Selenium
- pandas
- scikit-learn
- Tkinter
Subjects
- Machine Learning
- Linear Regression
- Web Scraping
About
Final project for the Linear Algebra course at Shiraz University (Spring 2024), done with AmirHossein Roodaki. The data was scraped from the Tehran mobile-phone section of divar.ir, an Iranian classifieds site. After the course I revisited the modelling, fixed the problems found in the original submission, and restructured the repository.
Pipeline
- Scrape — Selenium walks the listing page, opens each ad and saves its detail rows (3,221 rows).
- Clean — parse Persian numbers, units and prices, normalise colour text, drop duplicates and placeholder prices (a 1,000-Toman price on Divar means "contact me"). 3,221 rows become 1,751.
- Features — one-hot encode brand, condition, origin and colour; standardise SIM count, storage and RAM, fitted on the training split only.
- Model — linear regression on log(price), compared against ridge and a median-price baseline on a held-out 20% split.
- App — a Tkinter form that loads the saved model and predicts a price.
What the revision fixed
The original submission label-encoded 315 model names to integers, fitted encoders and outlier filters before the split, and let 50 test rows leak in as exact copies of training rows, producing some negative price predictions. The revised pipeline splits first, one-hot encodes, predicts log-price so predictions are always positive, and reports a baseline. R² stays around 0.50 with a test MAE of 9.8M Toman, but now it is a number you can believe.