13.1. Regression with scikit-learn#

Hide code cell source

path_data='../../data/'
import pandas as pd
import numpy as np
import sklearn 
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

In Chapter 12 you fit a regression line with one feature: its slope and intercept, and the least squares criterion that picks it (Regression Line); then residual plots for checking it and an interval for how far its slope can be trusted (Diagnostics and Inference). This section puts those ideas into a machine-learning workflow: several features at once, a model fit with the scikit-learn library, and a test on data the model has not seen.

Your neighbor is a real estate agent who wants a model that takes a few features of a house and returns an estimate of what it would sell for, and has given you a data set of house sales in Ames, Iowa, ames_housing.csv. The data are real: they come from the Ames Assessor’s Office and were published by Dean De Cock in the Journal of Statistics Education (2011). The file keeps normal sales from 2006 to 2010 (2,412 houses) and leaves out the few houses over 4,000 square feet, as De Cock recommends, because they are so unusual that they distort a simple model. This section uses these columns:

  • sale_price: the price the house sold for, in dollars (the target).

  • living_area: above-ground living area, in square feet.

  • overall_quality: the assessor’s rating of materials and finish, from 1 (very poor) to 10 (very excellent).

  • year_built: the year the house was built.

  • garage_cars: how many cars fit in the garage.

Note

The file has a few more columns (such as lot_area and neighborhood) that this section does not use. The coefficients you find describe Ames in 2006-2010. They are not a model of other housing markets.

13.1.1. Machine-Learning Framing#

Machine learning is a broad family of methods for using data to make predictions, detect patterns, or support decisions. In this part of the book, the goal is not to cover every algorithm family. The goal is to connect familiar statistical ideas to practical predictive workflows: define a target, choose useful features, train a model, test it on held-out data, and interpret the result in context.

Types of machine learning

Fig. 13.1 Types of machine learning tasks.#

The main algorithm families differ by the kind of question they answer:

  • Regression predicts a numeric target such as price, demand, or revenue.

  • Classification predicts a category such as churn/no churn, fraud/not fraud, or approved/denied.

  • Clustering finds groups when labels are not provided.

  • Ranking, pattern detection, time series, anomaly detection, survival analysis, and causal analysis support other common business questions.

Chapter 13 focuses on regression because it is the most direct bridge from the correlation and simple regression of Chapter 12 into predictive modeling. Chapters 14 and 15 then move to classification, and Chapter 16 to clustering.

13.1.1.1. Training, Validation, and Test Data#

In Chapter 12 you judged a line by its errors on the same data used to fit it. A predictive model should instead be judged on data it did not use for training, because the real question is how well it predicts new cases. A common workflow uses:

  1. A training set to fit the model.

  2. An optional validation set to compare choices such as features or tuning parameters.

  3. A test set to estimate performance on new cases.

Evaluation depends on the task. Regression models usually focus on prediction error and residual patterns. Classification models focus on how well the model separates classes. Clustering models focus on compact, separated, and interpretable groups.

Data needed for a machine-learning model

Fig. 13.2 Machine-learning models need enough relevant examples to estimate patterns reliably.#

13.1.1.2. Data Types in Predictive Work#

Machine-learning projects combine numeric, categorical, text, time, image, and other data types. Regression models in this chapter use numeric predictors, but the same planning question carries across methods: what information is available before the decision, and how should it be represented as model features?

Common data types in data science

Fig. 13.3 Common data types used in data science and machine-learning projects.#

13.1.2. From One Feature to Many#

The Chapter 12 line, \(\hat{y} = a + bx\), used one feature \(x\) to predict the target \(y\) (Regression Line). Real data sets rarely have a single useful feature, so this section turns to multiple regression, which fits a linear model using several predictors at once. This captures richer structure (for a house: size and quality and age) and measures the contribution of each feature while holding the others fixed.

13.1.2.1. The Model#

A multiple regression with predictors \(x_1, x_2, \dots, x_p\) and target \(y\) is written as:

\[ \hat{y} = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \cdots + \beta_p x_p \]
  • \(\beta_0\) is the intercept (predicted \(y\) when all predictors are 0).

  • Each \(\beta_j\) captures the change in \(\hat{y}\) for a one-unit increase in \(x_j\), holding other predictors constant.

With one predictor this is the Chapter 12 line, with \(\beta_0 = a\) and \(\beta_1 = b\). The coefficients are again chosen by least squares: they make the mean squared error on the training data as small as possible.

13.1.2.2. Typical Workflow#

  1. Inspect and clean the data; handle missing values and outliers.

  2. Explore relationships with scatter plots and a table of correlations. Strongly correlated predictors (multicollinearity) make individual coefficients harder to interpret.

  3. Split into training and testing sets.

  4. Fit the regression model on training data and examine the intercept and coefficients.

  5. Check the residuals (actual minus predicted) for patterns, for example with a plot of predicted against actual values and a histogram of the residuals.

  6. Evaluate on held-out test data using metrics like MAE, RMSE, and \(R^2\).

The rest of this section follows steps 2 to 6 for the housing data, which has already been cleaned. In Multiple Regression, you will look more closely at what the coefficients mean, why one can look odd, and whether the model beats a one-feature line and a nearest-neighbor approach on test homes.

13.1.3. Exploring the Housing Data#

Before fitting anything, look at the data. Exploratory data analysis means checking what the columns contain and how they relate before choosing a model. Start with the question from Chapter 12: how strongly is each candidate feature correlated with the sale price (Correlation)?

homes = pd.read_csv(path_data + 'ames_housing.csv')
features = ['living_area', 'overall_quality', 'year_built', 'garage_cars']

print(homes.shape)
homes[features + ['sale_price']].corr()['sale_price'].drop('sale_price').sort_values(ascending=False).round(2)
(2412, 10)
overall_quality    0.79
living_area        0.73
garage_cars        0.64
year_built         0.54
Name: sale_price, dtype: float64

All four features are positively correlated with the sale price. overall_quality is strongest (0.79), followed by living_area (0.73). The weakest is year_built (0.54): newer homes tend to cost more, but age alone leaves much of the price unexplained.

A scatter plot shows what a correlation of 0.73 looks like for living area.

fig, ax = plt.subplots(figsize=(7, 4))
ax.scatter(homes['living_area'], homes['sale_price'], s=6, alpha=0.4)
ax.set_xlabel('Living area (square feet)')
ax.set_ylabel('Sale price (dollars)')
ax.set_title('Ames homes: larger homes sell for more, with a wide spread')
plt.show()
../../_images/a02e3e34285a1066b72930901d8d7104bdae12880bf9664732fd0cdf8d5e1edd.png

Prices rise with size, and the cloud fans out: among large homes, prices range from moderate to very high. Two homes with the same living area can differ by $100,000 or more, so size alone leaves a lot unexplained. That is the reason to bring in more features.

The features also relate to one another, not just to the price. Here are the correlations among the four features.

homes[features].corr().round(2)
living_area overall_quality year_built garage_cars
living_area 1.00 0.55 0.21 0.48
overall_quality 0.55 1.00 0.56 0.57
year_built 0.21 0.56 1.00 0.51
garage_cars 0.48 0.57 0.51 1.00

The features overlap. overall_quality has correlations of 0.55 to 0.57 with each of the other three, and living_area and garage_cars have a correlation of 0.48. Better homes tend to be larger, newer, and to have bigger garages. When predictors are correlated like this, the data show multicollinearity: the model has a harder time separating one feature’s effect from another’s. Keep this in mind when you read the coefficients below.

### Exercise: Which Feature Tracks Price
# Six homes: price ($1,000s), living area (hundreds of square feet), quality (1-10), and age (years).
#   1. Compute the correlation of each feature with price using .corr(), rounded to 2 decimals.
#   2. Print the feature with the largest absolute correlation.
# Print exactly:
# area       0.99
# quality    0.94
# age       -0.91
# Strongest: area
import pandas as pd

ex_homes = pd.DataFrame({
    'price': [150, 210, 260, 330, 400, 480],
    'area': [10, 14, 15, 22, 25, 30],
    'quality': [4, 5, 7, 6, 8, 9],
    'age': [40, 35, 20, 30, 10, 5],
})
### Your code starts here.




### Your code ends here.

Hide code cell source

### Solution
import pandas as pd

ex_homes = pd.DataFrame({
    'price': [150, 210, 260, 330, 400, 480],
    'area': [10, 14, 15, 22, 25, 30],
    'quality': [4, 5, 7, 6, 8, 9],
    'age': [40, 35, 20, 30, 10, 5],
})

corr = ex_homes.drop(columns='price').corrwith(ex_homes['price']).round(2)

print(corr.to_string())
print('Strongest:', corr.abs().idxmax())
area       0.99
quality    0.94
age       -0.91
Strongest: area

13.1.4. Fitting the Model with scikit-learn#

scikit-learn is the most widely used Python library for machine learning. Its tools follow one pattern: choose a model, fit it to data, then use it to predict. The model used here, LinearRegression, fits the multiple regression equation from the previous part of this section by least squares.

13.1.4.1. Features and Target: X and y#

scikit-learn expects the data in two pieces. The feature matrix, called X by convention, is a table with one row per home and one column per feature. The response vector, called y, holds the value to predict for each home, here the sale price. The rows of X and y must line up: row 5 of X describes the home whose price is entry 5 of y.

X = homes[features]
y = homes['sale_price']

print('X has', X.shape[0], 'rows and', X.shape[1], 'columns')
print('y has', y.shape[0], 'entries')
X.head()
X has 2412 rows and 4 columns
y has 2412 entries
living_area overall_quality year_built garage_cars
0 1656 6 1960 2
1 896 5 1961 1
2 1329 6 1958 1
3 2110 7 1968 2
4 1629 5 1997 2

13.1.4.2. Holding Out Test Homes#

A buyer, a seller, or a lender would use this model to price homes that have not sold yet, so the fair test is how well it prices homes it has never seen. The train-test split sets aside a random share of the homes before fitting. The model learns from the rest, the training set, and is judged on the held-out test set. The code uses test_size=0.3, so 30% of the homes are held out. The random_state fixes the shuffle so that the same homes are held out each time; the code uses 13, the same split as in Multiple Regression.

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.3, random_state=13)

print('Training homes:', len(X_train))
print('Test homes:    ', len(X_test))
Training homes: 1688
Test homes:     724

The model will see 1,688 homes and be tested on the other 724.

13.1.4.3. Fitting the Model#

Fitting a model means finding the coefficients that fit the training data best. For LinearRegression, “best” is the least squares criterion from Regression Line: the coefficients that make the sum of the squared prediction errors on the training data as small as possible. The method .fit() does this calculation. Give it only the training data.

from sklearn.linear_model import LinearRegression

model = LinearRegression().fit(X_train, y_train)
print('Intercept:', round(model.intercept_))
Intercept: -839381

13.1.4.4. Reading the Coefficients#

The fitted model stores one coefficient for each column of X, in the same order. Labeling them with the column names makes them readable.

pd.Series(model.coef_, index=X.columns).round(2)
living_area           58.60
overall_quality    21197.72
year_built           395.25
garage_cars        12972.94
dtype: float64

Each coefficient answers a “what if” question about two homes. Take two homes that are the same in every feature except living area, where one has one more square foot. The model predicts the larger home sells for about $58.60 more. Now compare two homes that differ only in quality: one rating point higher goes with about $21,198 more. A home built one year later goes with about $395 more, and one more garage space goes with about $12,973 more.

Comparing homes that differ in a single feature while the other features stay the same is called holding the other features fixed. It is how every coefficient in a multiple regression is read.

The intercept is the prediction when every feature is 0. Here that is about -$839,000, a home with no living area, quality rating 0, built in the year 0. No such home exists, so the intercept has no business meaning. It only positions the fitted surface.

Do the numbers make sense? The signs do: larger, better built, newer homes with bigger garages sell for more. But read the sizes with care.

  • They are associations, not causes. These are patterns in Ames sales from 2006 to 2010. They do not show that adding a garage space or raising the quality rating of a particular home would raise its price by that amount.

  • They depend on the other features in the model. The features overlap (see the correlations above), so each coefficient is what remains after the others are accounted for. A regression of price on garage_cars alone would give a much larger coefficient, because garage size also stands in for the size and quality of the whole house. Multiple Regression shows how far this can go: a coefficient can even change sign when another feature enters the model.

### Exercise: Fit a Store Sales Model
# Use the simulated store data from Chapter 12 (store_ad_sales.csv).
#   1. Make X_store with the columns ad_spend and staff, and y_store with sales.
#      (New names keep the housing X and y intact.)
#   2. Split with train_test_split(X_store, y_store, test_size=0.25, random_state=1).
#   3. Fit a LinearRegression on the training data.
#   4. Print the intercept and a table of the coefficients, rounded to 2 decimals.
# Print exactly:
# Intercept: 36.78
# ad_spend    3.80
# staff       1.71
### Your code starts here.




### Your code ends here.

Hide code cell source

### Solution
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression

stores = pd.read_csv(path_data + 'store_ad_sales.csv')
X_store = stores[['ad_spend', 'staff']]
y_store = stores['sales']

Xs_train, Xs_test, ys_train, ys_test = train_test_split(
    X_store, y_store, test_size=0.25, random_state=1)

store_model = LinearRegression()
store_model.fit(Xs_train, ys_train)

print('Intercept:', round(store_model.intercept_, 2))
print(pd.Series(store_model.coef_, index=X_store.columns).round(2).to_string())
# Holding staff fixed, each extra $1,000 of weekly ad spend is associated with
# about 3.80 thousand dollars ($3,800) more in weekly sales (an association,
# not proof of cause). This is close to the Chapter 12 simple slope of about 3.87.
Intercept: 36.78
ad_spend    3.80
staff       1.71

13.1.5. Predictions and Evaluation Metrics#

13.1.5.1. Predictions on the Test Set#

Now use the model on the 724 test homes, which it has not seen. .predict() takes a feature matrix and returns one predicted price per row.

predicted = model.predict(X_test)

comparison = pd.DataFrame({'actual': y_test, 'predicted': predicted.round(0)})
comparison.head()
actual predicted
484 135000 131393.0
2168 183000 192736.0
2360 194000 146984.0
519 161500 169851.0
603 109500 107451.0

A scatter plot of predicted against actual price shows all the test homes at once. If every prediction were exact, the points would fall on the dashed 45-degree line.

fig, ax = plt.subplots(figsize=(6, 6))
ax.scatter(y_test, predicted, s=8, alpha=0.5)
limits = [y_test.min(), y_test.max()]
ax.plot(limits, limits, linestyle='--', color='red')
ax.set_xlabel('Actual sale price (dollars)')
ax.set_ylabel('Predicted sale price (dollars)')
ax.set_title('Test homes: predicted vs. actual price')
plt.show()
../../_images/8eac5e8b83e0f7ff8ec6c39295b0ba51e8f471d6c48123be8f195eb574bcd723.png

The points follow the line, so the model captures the main pattern. The spread widens at higher prices, and the most expensive homes sit mostly below the line: the model tends to under-price them. You can check that with the residuals. As in Chapter 12, a residual is the actual value minus the predicted value (Regression Line), so a positive residual means the model priced the home too low.

residuals = y_test - predicted

fig, ax = plt.subplots(figsize=(7, 4))
ax.hist(residuals, bins=30, edgecolor='white')
ax.set_xlabel('Residual: actual minus predicted price (dollars)')
ax.set_ylabel('Number of test homes')
ax.set_title('Most residuals are small, with a tail of under-priced homes')
plt.show()

print('Average residual, all test homes:     $', round(residuals.mean()))
print('Average residual, homes over $300,000: $', round(residuals[y_test > 300000].mean()))
print('Test homes over $300,000:', (y_test > 300000).sum())
print('Middle half of residuals: $', round(residuals.quantile(0.25)), 'to $', round(residuals.quantile(0.75)))
print('Test homes with residual over $100,000:', (residuals > 100000).sum())
../../_images/954d3a9fd0ff694ced3804b84ad7a326c3d614f39b5be788b55fdf82b9ba7cc9.png
Average residual, all test homes:     $ -43
Average residual, homes over $300,000: $ 67808
Test homes over $300,000: 40
Middle half of residuals: $ -21890 to $ 15540
Test homes with residual over $100,000: 10

The residuals center near zero, so the model is not too high or too low on average. The middle half of the residuals fall between about -$21,900 and $15,500, but the right tail is long: ten of the 724 homes sold for more than $100,000 above the prediction. The last lines show the pattern. Among the 40 test homes that sold for more than $300,000, the model’s prediction was about $67,800 too low on average. The features here do not capture what makes the most expensive homes special, such as neighborhood, lot size, and condition. A manager using this model should expect its quotes for top-end homes to be too low.

13.1.5.2. Regression Evaluation Metrics#

Plots show where a model misses. A manager also wants one number: how far off is a typical price quote, and how bad are the worst misses? Four metrics answer that. Write \(y_i\) for the actual price of home \(i\), \(\hat{y}_i\) for its predicted price, and \(n\) for the number of test homes.

  • The mean absolute error (MAE) is the average size of the miss, ignoring direction. It answers “how far off is a typical quote?” in dollars.

\[ \text{MAE} = \frac{1}{n}\sum_{i=1}^{n} \left| y_i - \hat{y}_i \right| \]
  • The mean squared error (MSE) is the average of the squared misses. Squaring makes a $100,000 miss count 100 times as much as a $10,000 miss, so large misses dominate. Its unit is dollars squared, which is hard to picture.

\[ \text{MSE} = \frac{1}{n}\sum_{i=1}^{n} \left( y_i - \hat{y}_i \right)^2 \]
  • The root mean squared error (RMSE) is the square root of the MSE. It is back in dollars, and it is the same measure of spread that Chapter 12 used for a regression line (Regression Line). Because large misses count for more, it is the better of the two when big misses are costly.

\[ \text{RMSE} = \sqrt{\text{MSE}} \]
  • R-squared (\(R^2\)) is the share of the variation in prices that the model explains. It compares the model’s squared errors with the squared errors from always predicting the average price \(\bar{y}\). A value of 1 is a perfect fit; 0 means no better than guessing the average.

\[ R^2 = 1 - \frac{\sum_{i=1}^{n} \left( y_i - \hat{y}_i \right)^2}{\sum_{i=1}^{n} \left( y_i - \bar{y} \right)^2} \]

Compute them by hand first, with NumPy, on the test homes.

errors = y_test.to_numpy() - predicted

mae = np.mean(np.abs(errors))
mse = np.mean(errors ** 2)
rmse = np.sqrt(mse)
r2 = 1 - np.sum(errors ** 2) / np.sum((y_test - y_test.mean()) ** 2)

pd.Series({'MAE': mae, 'MSE': mse, 'RMSE': rmse, 'R-squared': r2}).map('{:,.3f}'.format)
MAE                 23,200.027
MSE          1,014,282,790.078
RMSE                31,847.807
R-squared                0.790
dtype: str
# Typical sale price in the test set, for scale
print('Average test-home price: $', round(y_test.mean()))
print('MAE as a share of that:  ', round(100 * mae / y_test.mean(), 1), '%')
print('RMSE as a share of that: ', round(100 * rmse / y_test.mean(), 1), '%')
Average test-home price: $ 175234
MAE as a share of that:   13.2 %
RMSE as a share of that:  18.2 %

Now check the hand calculations against scikit-learn’s functions. Import them by name from sklearn.metrics.

from sklearn.metrics import (mean_absolute_error, mean_squared_error,
                             root_mean_squared_error, r2_score)

pd.Series({
    'MAE': mean_absolute_error(y_test, predicted),
    'MSE': mean_squared_error(y_test, predicted),
    'RMSE': root_mean_squared_error(y_test, predicted),
    'R-squared': r2_score(y_test, predicted),
}).map('{:,.3f}'.format)
MAE                 23,200.027
MSE          1,014,282,790.078
RMSE                31,847.807
R-squared                0.790
dtype: str

The two tables match. On the test set the MAE is about $23,200 and the RMSE is about $31,800. The RMSE is always at least as large as the MAE, because it gives more weight to the big misses seen in the residual plot; the more the RMSE exceeds the MAE, the more a few large misses are driving the error. \(R^2\) is about 0.79: the model explains about 79% of the variation in Ames sale prices. Compared with the average test-home price of about $175,000, a typical miss is roughly 13% and the RMSE is roughly 18%. That is useful for a first estimate, and it also shows how much the four features leave out, such as neighborhood and condition.

MAE, MSE, and RMSE are called loss functions: each turns the model’s errors into a single number for how much is lost by predicting wrongly, where smaller is better. Least squares in .fit() is the loss-function idea in action, since it picks the coefficients that make the MSE on the training data smallest.

Why compute the metrics on the test set rather than the training set? The coefficients were chosen to fit the training homes, so the training error is the model’s best case. The test homes played no part in the fit, so the test-set error is an honest estimate of what to expect on new homes. A model whose training error is much smaller than its test error has learned the quirks of its training data, not just the pattern.

### Exercise: Compute Error Metrics
# A model produced the predictions and actual values below (in $1,000s).
#   1. Calculate each error as actual minus predicted.
#   2. Print the MAE and the RMSE, rounded to 2 decimals.
#   3. Check both with metrics.mean_absolute_error and metrics.mean_squared_error
#      (import them with: from sklearn import metrics).
# Print exactly:
# Errors: [ 2 -3  4 -1]
# MAE:  2.5
# RMSE: 2.74
# Check: 2.5 2.74
ex_predicted = [98, 105, 110, 120]
ex_actual = [100, 102, 114, 119]
### Your code starts here.




### Your code ends here.

Hide code cell source

### Solution
from sklearn import metrics

ex_predicted = [98, 105, 110, 120]
ex_actual = [100, 102, 114, 119]
ex_errors = np.array(ex_actual) - np.array(ex_predicted)

print('Errors:', ex_errors)
print('MAE: ', round(np.mean(np.abs(ex_errors)), 2))
print('RMSE:', round(np.sqrt(np.mean(ex_errors ** 2)), 2))
print('Check:', metrics.mean_absolute_error(ex_actual, ex_predicted),
      round(np.sqrt(metrics.mean_squared_error(ex_actual, ex_predicted)), 2))
Errors: [ 2 -3  4 -1]
MAE:  2.5
RMSE: 2.74
Check: 2.5 2.74

13.1.6. Section Practice#

The agent asks whether lot size would improve the price quotes. Rerun the whole workflow of this section with a fifth feature, lot_area (the lot size in square feet), and compare the result with the four-feature model on the same test homes.

### Exercise: Add Lot Size
# Using the Ames homes:
#   1. Make X with living_area, overall_quality, year_built, garage_cars, and lot_area,
#      and y with sale_price.
#   2. Split with train_test_split(X, y, test_size=0.3, random_state=13), as in this section.
#   3. Fit a LinearRegression on the training data and predict the test homes.
#   4. Print the lot_area coefficient (rounded to 2 decimals), the test RMSE (rounded to
#      the nearest dollar), the test R-squared (rounded to 3 decimals), and whether the
#      test RMSE is below the four-feature model's 31848.
# Print exactly:
# lot_area coefficient: 1.41
# Test RMSE: 30657
# Test R-squared: 0.806
# Better than four features: True
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import root_mean_squared_error, r2_score

ex_homes = pd.read_csv(path_data + 'ames_housing.csv')
### Your code starts here.




### Your code ends here.

Hide code cell source

### Solution
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import root_mean_squared_error, r2_score

ex_homes = pd.read_csv(path_data + 'ames_housing.csv')
ex_features = ['living_area', 'overall_quality', 'year_built', 'garage_cars', 'lot_area']
ex_X = ex_homes[ex_features]
ex_y = ex_homes['sale_price']

ex_X_train, ex_X_test, ex_y_train, ex_y_test = train_test_split(
    ex_X, ex_y, test_size=0.3, random_state=13)

ex_model = LinearRegression().fit(ex_X_train, ex_y_train)
ex_pred = ex_model.predict(ex_X_test)
ex_rmse = root_mean_squared_error(ex_y_test, ex_pred)

print('lot_area coefficient:', round(ex_model.coef_[-1], 2))
print('Test RMSE:', round(ex_rmse))
print('Test R-squared:', round(r2_score(ex_y_test, ex_pred), 3))
print('Better than four features:', ex_rmse < 31848)
# Holding the other four features fixed, each extra square foot of lot goes with
# about $1.41 more in price. One split is one check, not proof that lot size helps.
lot_area coefficient: 1.41
Test RMSE: 30657
Test R-squared: 0.806
Better than four features: True