-
Notifications
You must be signed in to change notification settings - Fork 634
/
rvmLinear.R
30 lines (30 loc) · 1.53 KB
/
rvmLinear.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
modelInfo <- list(label = "Relevance Vector Machines with Linear Kernel",
library = "kernlab",
loop = NULL,
type = "Regression",
parameters = data.frame(parameter = "parameter",
class = "character",
label = "parameter"),
grid = function(x, y, len = NULL, search = "grid") data.frame(parameter = "none"),
fit = function(x, y, wts, param, lev, last, classProbs, ...) {
kernlab:::rvm(x = as.matrix(x), y = y,
kernel = kernlab::vanilladot(),
...)
},
predict = function(modelFit, newdata, submodels = NULL)
kernlab::predict(modelFit, newdata),
prob = NULL,
predictors = function(x, ...) {
if(hasTerms(x) & !is.null(x@terms))
{
out <- predictors.terms(x@terms)
} else {
out <- colnames(attr(x, "xmatrix"))
}
if(is.null(out)) out <- names(attr(x, "scaling")$x.scale$`scaled:center`)
if(is.null(out)) out <-NA
out
},
tags = c("Kernel Method", "Relevance Vector Machines", "Linear Regression",
"Robust Methods"),
sort = function(x) x)