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)
baggedMat <- table(
predict(baggedFit, testData[, -10]),
testData[, 10])
print(baggedMat)
classAgreement(baggedMat)
Run the code above in your browser using DataLab