Skip to content

Instantly share code, notes, and snippets.

@euclidjda
Last active November 29, 2016 16:04
Show Gist options
  • Select an option

  • Save euclidjda/387a0384bb419ffdae94 to your computer and use it in GitHub Desktop.

Select an option

Save euclidjda/387a0384bb419ffdae94 to your computer and use it in GitHub Desktop.
Simple C5.0 Tuning and Training Example
library(caret)
library(C50)
library(mlbench)
fitControl <- trainControl(method = "repeatedcv",
number = 10,
repeats = 10, returnResamp="all")
# Choose the features and classes
data(PimaIndiansDiabetes2)
x <- PimaIndiansDiabetes2[c("age","glucose","insulin","mass","pedigree","pregnant","pressure","triceps")]
y <- PimaIndiansDiabetes2$diabetes
grid <- expand.grid( .winnow = c(TRUE,FALSE), .trials=c(1,5,10,15,20), .model="tree" )
mdl<- train(x=x,y=y,tuneGrid=grid,trControl=fitControl,method="C5.0",verbose=FALSE)
mdl
# visualize the resample distributions
xyplot(mdl,type = c("g", "p", "smooth"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment