Category Archives: TidyX Screen Cast

TidyX Episode 179 – How many SpaghettiOs does it take to write LOTR?

This week, Ellis Hughes and I have a super fun TidyX Screen Cast that incorporates a number of different important tasks in your programming arsenal: writing custom functions and returning lists.

The functions we write don’t only explain how many Spaghettio’s it takes to write out Lord of the Rings but can actually be applied to various different books and novels (as we show in the episode).

To watch the screen cast, CLICK HERE.

To access our code, CLICK HERE.

TidyX Episode 176: Extracting all predictions from a Random Forest, Building Uncertainty Intervals, and Creating a Player Compare Tool

In this installment of predicting whether MLB pitchers will make the Hall of Fame, Ellis Hughes and I take the Random Forest model we built in Episode 175 and discuss how you can extract the predictions from each of the individual trees and then build uncertainty intervals so that you can construct an entire distribution of predictions. We then take these predictions and build a custom function for comparing the predicted distribution of two players and whether they will make it to the Hall of Fame.

To watch the screen cast, CLICK HERE.

To access our code, CLICK HERE.

TidyX Episode 175: Predicting Hall of Fame Pitchers using Random Forests

Ellis Hughes and I continue to work with the MLB pitcher data, courtesy of the {Lahman} baseball package.

This week we walk through using a random forest model to calculate the probability a pitcher will make it to the Hall of Fame given several different performance stats.

In this episode we cover:

  • Splitting data into training and testing sets
  • Splitting training sets into cross validated folds
  • Using {tidyverse} and {purrr} to construct a tuning grid and tune the random forest models to identify the optimal mtry and ntrees for the prediction task
  • Fitting a final model with the optimized parameters and exploring predictions

To watch our screen cast, CLICK HERE.

To access our code, CLICK HERE.