library(mlbench)
library(earth)
data(Glass)
set.seed(36)
inTrain <- sample(1:dim(Glass)[1], 150)
trainData <- Glass[ inTrain, ]
testData <- Glass[-inTrain, ]
baggedFit <- bagFDA(Type ~ ., trainData)
confusionMatrix(predict(baggedFit, testData[, -10]),
testData[, 10])
Run the code above in your browser using DataLab