Lesson 17 of 18 · 2 min · practice
Practice Questions
P1. Load California Housing dataset. Print shape, first 5 rows, and describe(). How many features are there?
P2. Split California Housing into X (features) and y (Price). Do train_test_split with test_size=0.2. How many rows in train vs test?
P3. Train LinearRegression on California Housing. Print all coefficients. Which feature has the highest positive coefficient? What does that mean?
P4. Predict on test set. Calculate MAE, MSE, RMSE. Convert RMSE to actual dollars (multiply by 100,000). Is the model good?
P5. Plot Actual vs Predicted scatter plot. Add the diagonal reference line. Are points clustered near the line or spread far?
P6. What is R² score? Calculate it. A model gives R²=0.45 — is that good or bad? Why?
P7. Try removing the least important feature (lowest absolute coefficient) and retrain. Does RMSE improve or worsen?
P8. Use a housing CSV with these columns: price, area, bedrooms, bathrooms, stories, furnishingstatus. Build multiple regression to predict price. Calculate MAE and RMSE.
