Growing trees

Lab 4G

Directions: Follow along with the slides and answer the questions in red font in your journal.

Trees vs. Lines

Our first tree

Viewing trees

Leafier trees

Tree complexity

Misclassification rate

calc_mcr <- function(actual, predicted) {
  sum(____ != ____) / length(____)
}

Predictions and Cross-validation

titanic_test <- mutate(____, prediction = predict(____, newdata = ____, type = "class"))
summarize(titanic_test, mcr = calc_mcr(survived, prediction))

On your own