


There are a number of pre-processing steps that are easily implemented by caret. The abalone data came from the UCI Machine Learning repository (we split the data into a training and test set).įirst we load the data into R: # load in packages In the example below, we will use the ranger implementation of random forest to predict whether abalone are “old” or not based on a bunch of physical properties of the abalone (sex, height, weight, diameter, etc).

The types of modeling options available are many and are listed here. To implement your machine learning model of choice using caret you will use the train function. Not only does caret allow you to run a plethora of ML methods, it also provides tools for auxiliary techniques such as:ĭata preparation (imputation, centering/scaling data, removing correlated predictors, reducing skewness)Īn extensive vignette for caret can be found here: Ī simple view of caret: the default train function Apparently caret has little to do with our orange friend, the carrot. Caret stands for Classification And Regression Training. Recognizing this, Max Kuhn (at the time working in drug discovery at Pfizer, now at RStudio) put together a single package for performing any machine learning method you like. This means that if you want to do machine learning in R, you have to learn a large number of separate methods. R has a wide number of packages for machine learning (ML), which is great, but also quite frustrating since each package was designed independently and has very different syntax, inputs and outputs. Feel free to download it and use for your own learning or teaching adventures! Package developed by Max Kuhn.Īn interactive Jupyter Notebook version of this tutorial can be found at.
Caret in r manual#
It has been modified lightly so that it uses a manual old variable (is the abalone older than 10 or not) and ignores the numeric age variable. Older note: This tutorial was based on an older version of the abalone data that had a binary old varibale rather than a numeric age variable.
Caret in r code#
Don’t worry though, your caret code will still work! Tidymodels is essentially caret’s successor. Note: If you’re new to caret, I suggest learning tidymodels instead ( ).
