Growing trees

Lab 4G

Directions: Follow along with the slides, completing the questions in blue on your computer, and answering the questions in red in your journal.

Space, Click, Right Arrow or swipe left to move to the next slide.

Trees vs. Lines

Our first tree

Viewing trees

Leafier trees

Tree complexity

Predictions and Cross-validation

titanic_test <- mutate(____, prediction = predict(____, newdata = ____, type = "class"))

Measuring model performance

View(select(titanic_test, survived, prediction))

Misclassification rate

calc_mcr <- function(actual, predicted) {
  sum(____ != ____) / length(actual)
}
summarize(titanic_test, mcr = calc_mcr(survived, prediction))

On your own