Last active
October 27, 2017 06:26
-
-
Save halilbilgin/33d68e7672d7a4be2a234c00e6b020b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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