Session Ready
Exercise

Train a model using test/train split

Now that you have split the mpg dataset into mpg_train and mpg_test, you will use mpg_train to train a model to predict city fuel efficiency (cty) from highway fuel efficiency (hwy).

Instructions
100 XP

The data frame mpg_train is in the workspace.

  • Create a formula fmla that expresses the relationship cty as a function of hwy. Print it.
  • Train a model mpg_model on mpg_train to predict cty from hwy using fmla and lm().
  • Use summary() to examine the model.