Chapter 7 Train best model
Let`s fit the best model with our training data:
<-
lm_fit %>%
lm_spec fit(
~ median_income, # best model
median_house_value data = new_train
)
# Show your fitted model
lm_fit
## parsnip model object
##
## Fit time: 3ms
##
## Call:
## stats::lm(formula = median_house_value ~ median_income, data = data)
##
## Coefficients:
## (Intercept) median_income
## 44477 41924