Tidy grid search with pipelearner
@drsimonj here to show you how to use pipelearner to easily grid-search hyperparameters for a model.
pipelearner is a package for making machine learning piplines and is currently available to install from GitHub by running the following:
# install.packages("devtools") # Run this if devtools isn't installed devtools::install_github("drsimonj/pipelearner") library(pipelearner)
In this post we’ll grid search hyperparameters of a decision tree (using the rpart package) predicting cars’ transmission type (automatic or manual) using the mtcars data set. Let’s load rpart along with tidyverse, which pipelearner is intended to work with:
Quickly convert our outcome variable to a factor with proper labels:
d <- mtcars %>% mutate(am = factor(am, labels = c("automatic", "manual"))) head(d) #> mpg cyl disp hp drat wt qsec vs am
Continue reading →