Title: | The SVR Path Algorithm |
---|---|
Description: | Computes the entire solution paths for Support Vector Regression(SVR) with respect to the regularization parameter, lambda and epsilon in epsilon-intensive loss function, efficiently. We call each path algorithm svrpath and epspath. See Wang, G. et al (2008) <doi:10.1109/TNN.2008.2002077> for details regarding the method. |
Authors: | Do Hyun Kim [aut, cre], Seung Jun Shin [aut] |
Maintainer: | Do Hyun Kim <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.2 |
Built: | 2025-02-11 02:40:26 UTC |
Source: | https://github.com/cran/svrpath |
epsilon
path for Support Vector RegressionThe Suport Vector Regression (SVR) employs epsilon-intensive loss which ignores errors smaller than epsilon. This algorithm computes the entire paths for SVR solution as a function of epsilon
at a given regularization parameter lambda
, which we call epsilon
path.
epspath(x, y, lambda = 1, kernel.function = radial.kernel, param.kernel = 1, ridge = 1e-08, eps = 1e-07, eps.min = 1e-08, ...)
epspath(x, y, lambda = 1, kernel.function = radial.kernel, param.kernel = 1, ridge = 1e-08, eps = 1e-07, eps.min = 1e-08, ...)
x |
The data matrix (n x p) with n rows (observations) on p variables (columns) |
y |
The real number valued response variable |
lambda |
The regularization parameter value. |
kernel.function |
User defined kernel function. See |
param.kernel |
Parameter(s) of the kernels. See |
ridge |
Sometimes the algorithm encounters singularities; in this case a small value of ridge can help, default is |
eps |
A small machine number which is used to identify minimal step sizes |
eps.min |
The smallest value of epsilon for termination of the algorithm. Default is |
... |
Generic compatibility |
An 'epspath' object is returned.
Do Hyun Kim, Seung Jun Shin
predict.epspath
, plot.epspath
, svrpath
set.seed(1) n <- 30 p <- 50 x <- matrix(rnorm(n*p), n, p) e <- rnorm(n, 0, 1) beta <- c(1, 1, rep(0, p-2)) y <- x %*% beta + e lambda <- 1 eobj <- epspath(x, y, lambda = lambda)
set.seed(1) n <- 30 p <- 50 x <- matrix(rnorm(n*p), n, p) e <- rnorm(n, 0, 1) beta <- c(1, 1, rep(0, p-2)) y <- x %*% beta + e lambda <- 1 eobj <- epspath(x, y, lambda = lambda)
produces a plot of the SVR epsilon
path.
## S3 method for class 'epspath' plot(x, intercept = FALSE, ...)
## S3 method for class 'epspath' plot(x, intercept = FALSE, ...)
x |
The epspath object |
intercept |
If it is |
... |
Generic compatibility |
The entire solution path of SVR solution as a function of epsilon
.
Do Hyun Kim, Seung Jun Shin
# The 'eobj' is given by examples description of epspath(). plot(eobj, lty = 2, lwd = 2, col = 2, cex.lab = 1.5)
# The 'eobj' is given by examples description of epspath(). plot(eobj, lty = 2, lwd = 2, col = 2, cex.lab = 1.5)
produces a plot of the SVR lambda
path.
## S3 method for class 'svrpath' plot(x, intercept = FALSE, ...)
## S3 method for class 'svrpath' plot(x, intercept = FALSE, ...)
x |
The svrpath object |
intercept |
If it is |
... |
Generic compatibility |
The entire solution path of SVR solution as a function of lambda
.
Do Hyun Kim, Seung Jun Shin
# The 'obj' is given by examples description of svrpath(). plot(obj, lty = 2, lwd = 2, col = 2, cex.lab = 1.5)
# The 'obj' is given by examples description of svrpath(). plot(obj, lty = 2, lwd = 2, col = 2, cex.lab = 1.5)
Provides a prediction value at a given epsilon
from epspath
object.
## S3 method for class 'epspath' predict(object, newx, svr.eps = 1, ...)
## S3 method for class 'epspath' predict(object, newx, svr.eps = 1, ...)
object |
The epspath object |
newx |
Values of x to be predicted. This is a matrix with observations per row. Default is x in the epspath object. |
svr.eps |
The value of the "epsilon-insensitive loss" paramter, epsilon. |
... |
Generic compatibility |
In each case, the desired prediction.
Do Hyun Kim, Seung Jun Shin
# The 'eobj' is given by examples description of epspath(). predict(eobj, svr.eps = .1)
# The 'eobj' is given by examples description of epspath(). predict(eobj, svr.eps = .1)
Provides a prediction value at a given lambda
from svrpath
object.
## S3 method for class 'svrpath' predict(object, newx, lambda = NULL, criterion = "sic", ...)
## S3 method for class 'svrpath' predict(object, newx, lambda = NULL, criterion = "sic", ...)
object |
The svrpath object |
newx |
Values of x to be predicted. This is a matrix with observations per row. Default is x in the epspath object. |
lambda |
The value of the regularization paramter, lambda. |
criterion |
It provides predictions at an optimal |
... |
Generic compatibility |
In each case, the desired prediction.
Do Hyun Kim, Seung Jun Shin
# The 'eobj' is given by examples description of epspath(). predict.svrpath(obj, lambda = 10) # or predict(obj, criterion = 'sic')
# The 'eobj' is given by examples description of epspath(). predict.svrpath(obj, lambda = 10) # or predict(obj, criterion = 'sic')
solves quadratic programming(QP) for SVR.
## S3 method for class 'svr' solve(a, b, lambda = 1, svr.eps = 1, kernel.function = radial.kernel, param.kernel = 1, ...)
## S3 method for class 'svr' solve(a, b, lambda = 1, svr.eps = 1, kernel.function = radial.kernel, param.kernel = 1, ...)
a |
The data matrix (n x p) with n rows (observations) on p variables (columns) |
b |
The real number valued response variable |
lambda |
The regularization parameter |
svr.eps |
Epsilon in epsion-insensitive loss function |
kernel.function |
User defined kernel function. See |
param.kernel |
Parameter(s) of the kernels. See |
... |
Generic compatibility |
SVR solution at a given lambda
and epsilon
Dohyun Kim, Seung Jun Shin
# set.seed(1) n <- 30 p <- 50 x <- matrix(rnorm(n*p), n, p) e <- rnorm(n, 0, 1) beta <- c(1, 1, rep(0, p-2)) y <- x %*% beta + e solve.svr(x, y)
# set.seed(1) n <- 30 p <- 50 x <- matrix(rnorm(n*p), n, p) e <- rnorm(n, 0, 1) beta <- c(1, 1, rep(0, p-2)) y <- x %*% beta + e solve.svr(x, y)
This algorithm computes the entire regularization path for the support vector regression with a relatively low cost compared to quadratic programming problem.
svrpath(x, y, svr.eps = 1, kernel.function = radial.kernel, param.kernel = 1, ridge = 1e-08, eps = 1e-08, lambda.min = 1e-08, ...)
svrpath(x, y, svr.eps = 1, kernel.function = radial.kernel, param.kernel = 1, ridge = 1e-08, eps = 1e-08, lambda.min = 1e-08, ...)
x |
The data matrix (n x p) with n rows (observations) on p variables (columns) |
y |
The real number valued response variable |
svr.eps |
An epsilon in epsilon-insensitive loss function |
kernel.function |
This is a user-defined function. Provided are |
param.kernel |
The parameter(s) for the kernel. For this radial kernel, the parameter is known in the fields as "gamma". For the polynomial kernel, it is the "degree" |
ridge |
Sometimes the algorithm encounters singularities; in this case a small value of ridge can help, default is |
eps |
A small machine number which is used to identify minimal step sizes |
lambda.min |
The smallest value of lambda for termination of the algorithm. Default is |
... |
Generic compatibility |
A 'svrpath' object is returned, for which there are lambda
values and corresponding values of theta
for each data point.
Do Hyun Kim, Seung Jun Shin
predict.svrpath
, plot.svrpath
, epspath
set.seed(1) n <- 30 p <- 50 x <- matrix(rnorm(n*p), n, p) e <- rnorm(n, 0, 1) beta <- c(1, 1, rep(0, p-2)) y <- x %*% beta + e svr.eps <- 1 obj <- svrpath(x, y, svr.eps = svr.eps)
set.seed(1) n <- 30 p <- 50 x <- matrix(rnorm(n*p), n, p) e <- rnorm(n, 0, 1) beta <- c(1, 1, rep(0, p-2)) y <- x %*% beta + e svr.eps <- 1 obj <- svrpath(x, y, svr.eps = svr.eps)