Learn R Programming

LinearizedSVR (version 1.3)

LinearizedSVRTrain: LinearizedSVRTrain

Description

Train a prototype-based Linearized Support-Vector Regression model

Usage

LinearizedSVRTrain(X, Y, C = 1, epsilon = 0.01, nump = floor(sqrt(N)), ktype = rbfdot, kpar, prototypes = c("kmeans", "random"), clusterY = FALSE, epsilon.up = epsilon, epsilon.down = epsilon, expectile = NULL, scale = TRUE, sigest = sigma.est)

Arguments

X
matrix of examples, one example per row.
Y
vector of target values. Must be the same length as the number of rows in X.
C
cost of constraints violation
epsilon
tolerance of termination criterion for optimization
nump
number of prototypes by which to represent each example in X
ktype
kernel-generating function, typically from the kernlab package
kpar
a list of any parameters necessary for ktype. See Details.
prototypes
the method by which prototypes will be chosen
clusterY
whether to cluster X and Y jointly when using prototypes="kmeans". Otherwise X is clustered without influence from Y.
epsilon.up
allows you to use a different setting for epsilon in the positive direction.
epsilon.down
allows you to use a different setting for epsilon in the negative direction.
expectile
if non-null, do expectile regression using the given expectile value. Currently uses the expectreg package.
scale
a boolean value indicating whether X and Y should be normalized (to zero-mean and unit-variance) before learning.
sigest
if the kernel expects a sigma parameter and none is provided in kpar, this parameter specifies a function to use to compute it.

Value

a model object that can later be used as the first argument for the predict() method.

Details

This function trains a new LinearizedSVR model based on X and Y. See LinearizedSVR-package for an explanation of how such models are defined.

See Also

LinearizedSVR-package

Examples

Run this code
dat <- rbind(data.frame(y=2, x1=rnorm(500, 1), x2=rnorm(500, 1)),
             data.frame(y=1, x1=rnorm(500,-1), x2=rnorm(500,-1)))
mod <- LinearizedSVRTrain(X=as.matrix(dat[-1]), Y=dat$y, nump=6)
res <- predict(mod, newdata=as.matrix(dat[-1]))
plot(x2 ~ x1, dat, col=c("red","green")[1+(res>1.5)], pch=c(3,20)[dat$y])

Run the code above in your browser using DataLab