# NOT RUN {
# Create a empty model of type FOO
mltrain.baseFOO <- function (object, ...) {
mymodel <- list(
classes = as.character(unique(object$data[, object$labelindex]))
)
class(mymodel) <- 'fooModel'
mymodel
}
# Using this base method with Binary Relevance
brmodel <- br(toyml, 'FOO')
# }
# NOT RUN {
# Create a SVM method using the e1071 package
library(e1071)
mltrain.baseSVM <- function (object, ...) {
traindata <- object$data[, -object$labelindex]
labeldata <- object$data[, object$labelindex]
model <- svm(traindata, labeldata, probability = TRUE, ...)
model
}
# }
Run the code above in your browser using DataLab