Search⌘ K
AI Features

LR Implementation Steps: 8 and 9

Understand how to implement the final steps of linear regression by predicting property values and evaluating model performance using mean absolute error. Explore why certain variables impact accuracy and consider ways to improve your model with practical Python code examples.

We'll cover the following...

8) Predict

Let’s now run the model to find the value of an individual property by creating a new variable (new_house) using the following input features:

C++
#8. Predict
new_house = [
2, #Rooms
2.5, #Distance
1, #Bathroom
1, #Car
]
new_house_predict = model.predict([new_house])
print(new_house_predict)

The predicted value of this house is AUD $981,746.347. The actual value of this house, according to the dataset, is AUD $1,480,000.

9) Evaluate

Using mean absolute error from Scikit-learn, ...