Get startedGet started for free

Complete model fitting process with last_fit()

In this exercise, you will train and evaluate the performance of a linear regression model that predicts selling_price using all the predictors available in the home_sales tibble.

This exercise will give you a chance to perform the entire model fitting process with tidymodels, from defining your model object to evaluating its performance on the test data.

Earlier in the chapter, you created an rsample object called home_split by passing the home_sales tibble into initial_split(). The home_split object contains the instructions for randomly splitting home_sales into training and test sets.

The home_sales tibble, and home_split object have been loaded into this session.

This exercise is part of the course

Modeling with tidymodels in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Define a linear regression model
linear_model <- ___ %>% 
  set_engine(___) %>% 
  set_mode(___)
Edit and Run Code