1 #' @include b_Algorithm.R
3 #' @title SVM Algorithm
5 #' @description SVM classifier.
6 #' Inherits \code{\link{Algorithm}}
9 #' @field someParam TODO
11 SVMclassif = setRefClass(
19 contains = "Algorithm",
22 initialize = function(...)
27 predict_noNA = function(XY, x)
32 require(kernlab, quietly=TRUE)
33 XY[,"alert"] = XY[,"Measure"] > 30
34 alertsIndices = XY[,"alert"]
35 XY[alertsIndices,"alert"] = "alert"
36 XY[!alertsIndices,"alert"] = "noalert"
37 XY[,"alert"] = as.factor(XY[,"alert"])
40 ks = ksvm(alert ~ ., data=XY)
41 pred = as.character(predict(ks, as.data.frame(x)))
42 pred[pred == "alert"] = 70
43 pred[pred == "noalert"] = 10
44 return (as.numeric(pred))