Lessons
-
Car price prediction project
Introduce the car price project, its Kaggle dataset, the MSRP target, and the steps of the project plan.
-
Data preparation
Load the Kaggle car dataset with pandas and normalize column names and string values to lowercase with underscores.
-
Exploratory data analysis
Explore each column, log-transform the long-tailed price distribution, and count missing values.
-
Setting up the validation framework
Split the car data into shuffled 60/20/20 train, validation, and test sets using plain pandas and NumPy.
-
Linear regression
Implement a linear regression prediction for one car as a weighted sum of its features plus a bias.
-
Linear regression: vector form
Rewrite linear regression as a dot product and then a matrix-vector multiplication that predicts all cars at once.
-
Training linear regression: Normal equation
Derive the normal equation for linear regression weights and implement it as a train_linear_regression function.
-
Baseline model for car price prediction project
Train a baseline model on five numerical features, filling missing values with zeros, and compare its predictions with actual prices.
-
Root Mean Squared Error (RMSE)
Explain RMSE with a worked example, implement it in NumPy, and apply it to the baseline model.
-
Computing RMSE on validation data
Build a prepare_X helper and compute RMSE on the validation set instead of the training set.
-
Feature engineering
Create an age feature from the year column, copy the dataframe in prepare_X, and check how it lowers validation RMSE.
-
Categorical variables
Encode doors, make, and other categories as binary columns, and observe that adding them all worsens validation RMSE.
-
Regularization
Explain why the normal equation breaks on duplicate features and add a diagonal term to keep weights stable.
-
Tuning the model
Tune the regularization parameter on the validation set, then train the model with the chosen value.
-
Using the model
Train the final model on train and validation data, check its test RMSE, and predict the price of one car.
-
Car price prediction project summary
Recap the car price project, covering data preparation, linear regression, RMSE, feature engineering, and regularization.
-
Explore more
Suggest optional practice ideas, including testing 10 features and trying other regression datasets.
Homework
Homework 2: Machine Learning for Regression
Scored7 questions · 2026 cohort · closed Oct 5, 2026
Recordings, code and notes
- Community notes
- Notes from Kwang Yang Notes from Sebastián Ayala Ruano Notes from Ayoub Berdeddouch Notes from Alvaro Navas Notes from froukje Notes from Jon Areas Notes from Memoona Tahira Notes from Wesley Barreto Notes from Hareesh Tummala Notes from Anneysha Sarkar Notes from Peter Ernicke Notes from Marcos Benício Notes from Oscar Garcia Notes from Maximilien Eyengue Notes from Kemal Dahha Cohort 2025 | Notes By Nitin Gupta