Skip to content

Project · Data Science, Machine Learning and AI

Project: a rent model for Pune flats

Projectintermediate· about 5 hours· 7 steps

The brief

A rental startup wants a fair-rent estimate for 2BHK flats in Pune. Build a linear regression from scratch: split the data, fit the line by least squares, score it against a baseline, fit it again by gradient descent, and study the errors to find what the model is missing.

Why it matters

Property portals, banks valuing homes and pricing teams at e-commerce firms all start with a simple regression and an honest evaluation. Interviewers often ask candidates to code least squares and gradient descent by hand, and to explain why the model must beat a baseline on data it has not seen.

Skills you practise

  • train/test split
  • least-squares regression
  • MAE, RMSE and R²
  • baselines
  • gradient descent and feature scaling
  • residual analysis

What you will have at the end

model.py and a one-page model note: the fitted line, test MAE against the baseline, the gradient-descent check, and the locality finding with a plan for the next model.

How it is marked (rubric, 100 points)
Correct modelAll seven checks pass: split, least squares, metrics, baseline, gradient descent and residuals.40
Honest evaluationThe test set is never used for fitting, and the model is compared with a baseline, not only shown on its own.25
UnderstandingYou can explain least squares, why scaling made gradient descent work, and what R² below 0 means.20
Model noteA short note states the test MAE in rupees, the main weakness (location) and what you would try next.15

0/7 steps done

Step 1 of 7

Hold out a test set

split(FLATS) returns (train, test) with 16 and 4 rows: every 5th row (positions 5, 10, 15 and 20) goes to test.

A model must be judged on flats it never saw, or it will look better than it is. Keep the split repeatable: here every 5th row (index 4, 9, 14, 19) is the test set. At work you would shuffle with a fixed seed first (train_test_split(..., random_state=42)), but a fixed rule like this gives the same answer on every computer.

Run shows what your code prints. Check runs the step's tests. Ctrl+Enter checks too.