Exercise

From zero to hero

You mastered the skills of creating a model specification and splitting the data into training and test sets. You also know how to avoid class imbalances in the split. It's now time to combine what you learned in the preceding lesson and build your model using only the training set!

You are going to build a proper machine learning pipeline. This is comprised of creating a model specification, splitting your data into training and test sets, and last but not least, fitting the training data to a model. Enjoy!

Instructions

100 XP
  • Create diabetes_split, a split where the training set contains three-quarters of all diabetes rows and where training and test sets have a similar distribution in the outcome variable.
  • Build a decision tree specification for your model using the rpart engine and save it as tree_spec.
  • Fit a model model_trained using the training data of diabetes_split with outcome as the target variable and bmi and skin_thickness as the predictors.