Easy leave-one-out cross validation with pipelearner
@drsimonj here to show you how to do leave-one-out cross validation using pipelearner.
Leave-one-out cross validation
Leave-one-out is a type of cross validation whereby the following is done for each observation in the data:
- Run model on all other observations
- Use model to predict value for observation
This means that a model is fitted, and a predicted is made n times where n is the number of observations in your data.
Leave-one-out in pipelearner
pipelearner is a package for streamlining machine learning pipelines, including cross validation. If you’re new to it, check out blogR for other relevant posts.
To demonstrate, let’s use regression to predict horsepower (
hp) with all other variables in the
mtcars data set. Set this up in pipelearner as follows:
library(pipelearner) pl <- pipelearner(mtcars, lm, hp ~ .)
How cross validation is done is handled by
Continue reading →