Skip to content

Instantly share code, notes, and snippets.

@halilbilgin
Last active October 27, 2017 06:26
Show Gist options
  • Save halilbilgin/33d68e7672d7a4be2a234c00e6b020b5 to your computer and use it in GitHub Desktop.
Save halilbilgin/33d68e7672d7a4be2a234c00e6b020b5 to your computer and use it in GitHub Desktop.
modelInfo <- list(label = "nu-SVR with Radial Basis Function Kernel",
library = "e1071",
type = c("Regression"),
parameters = data.frame(parameter = c("nu", "C", "gamma"),
class = c("numeric", "numeric", "numeric"),
label = c("Nu", "Cost", "Gamma")),
loop = NULL,
grid=NULL,
fit = function(x, y, wts, param, lev, last, classProbs, ...) {
if(any(names(list(...)) == "prob.model") | is.numeric(y)) {
out <- svm(x = as.matrix(x), y = y,
scale=FALSE,
type='nu-regression',
kernel = 'radial',
gamma = param$gamma,
cost = param$C,
nu = param$nu, ...)
}
out
},
predict = function(modelFit, newdata, submodels = NULL) {
predict(modelFit, newdata=newdata)
},
prob = function(modelFit, newdata, submodels = NULL) {
FALSE
},
predictors = function(x, ...){
FALSE
},
tags = c("Kernel Method", "Support Vector Machines", "Radial Basis Function",
"Robust Methods"),
levels = function(x) lev(x),
sort = function(x) {
# If the cost is high, the decision boundary will work hard to
# adapt. Also, if C is fixed, smaller values of sigma yeild more
# complex boundaries
x[order(x$C, -x$gamma),]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment