Model evaluation and selection
We will begin by creating our training and testing sets, then create a random forest classifier as our base model. After evaluating its performance, we will move on and try the one-versus-rest classification method and see how it performs. We split our data 70/30. Also, one of the unique things about the mlr
package is its requirement to put your training data into a "task" structure, specifically a classification task. Optionally, you can place your test set in a task as well.
A full list of models is available here, plus you can also utilize your own:
https://mlr-org.github.io/mlr-tutorial/release/html/integrated_learners/index.html
> library(caret) #if not already loaded > set.seed(502) > split <- createDataPartition(y = df$class, p = 0.7, list = F) > train <- df[split, ] > test <- df[-split, ] > wine.task <- makeClassifTask(id = "wine", data = train, target = "class")
Random forest
With our training...