| Title: | The Entire Solution Paths for ROC-SVM |
|---|---|
| Description: | We develop the entire solution paths for ROC-SVM presented by Rakotomamonjy. The ROC-SVM solution path algorithm greatly facilitates the tuning procedure for regularization parameter, lambda in ROC-SVM by avoiding grid search algorithm which may be computationally too intensive. For more information on the ROC-SVM, see the report in the ROC Analysis in AI workshop(ROCAI-2004) : Hernà ndez-Orallo, José, et al. (2004) <doi:10.1145/1046456.1046489>. |
| Authors: | Seung Jun Shin [aut, cre], Do Hyun Kim [aut] |
| Maintainer: | Seung Jun Shin <[email protected]> |
| License: | GPL-2 |
| Version: | 0.1.0 |
| Built: | 2026-06-01 10:51:41 UTC |
| Source: | https://github.com/cran/rocsvm.path |
produces a plot of the ROC-SVM lambda path.
## S3 method for class 'rocsvm' plot(x, ...)## S3 method for class 'rocsvm' plot(x, ...)
x |
The rocsvm path object |
... |
Generic compatibility |
The entire solution path of ROC-SVM solution as a function of lambda.
Seung Jun Shin, Do Hyun Kim
# The 'obj' comes from an example description of rocsvm.path() library(rocsvm.path) n <- 30 p <- 2 delta <- 1 set.seed(309) y <- c(rep(1, n/2), rep(-1, n/2)) x <- matrix(0, n, p) for (i in 1:n){ if (y[i] == 1) { x[i,] <- rnorm(p, -delta, 1) } else { x[i,] <- rnorm(p, delta, 1) } } rho = 1 kernel = radial.kernel param.kernel = 1/ncol(x) prop = 0.1 obj <- rocsvm.path(x, y, rho, kernel, param.kernel, prop) plot(obj) # or plot.rocsvm(obj, lty = 2, lwd = 2, col = 2)# The 'obj' comes from an example description of rocsvm.path() library(rocsvm.path) n <- 30 p <- 2 delta <- 1 set.seed(309) y <- c(rep(1, n/2), rep(-1, n/2)) x <- matrix(0, n, p) for (i in 1:n){ if (y[i] == 1) { x[i,] <- rnorm(p, -delta, 1) } else { x[i,] <- rnorm(p, delta, 1) } } rho = 1 kernel = radial.kernel param.kernel = 1/ncol(x) prop = 0.1 obj <- rocsvm.path(x, y, rho, kernel, param.kernel, prop) plot(obj) # or plot.rocsvm(obj, lty = 2, lwd = 2, col = 2)
Compute the kernel matrix for ROC-SVM path. This function comes from svmpath package by Trevor Hastie. If you want to know details of this function, refer the svmpath package.
poly.kernel(x, y = x, param.kernel = 1, ...)poly.kernel(x, y = x, param.kernel = 1, ...)
x |
An n x p matrix of features |
y |
An m x p matrix of features |
param.kernel |
The parameter(s) for the kernel. For the radial kernel, the parameter is known in the fields as "gamma". For the polynomial kernel, it is the "degree" |
... |
unused |
Compute the kernel matrix for ROC-SVM path. This function comes from svmpath package by Trevor Hastie. If you want to know details of this function, refer the svmpath package.
radial.kernel(x, y = x, param.kernel = 1/p, ...)radial.kernel(x, y = x, param.kernel = 1/p, ...)
x |
An n x p matrix of features |
y |
An m x p matrix of features |
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" |
... |
unused |
Computes solution alpha values from a fixed regularization parameter, lambda value for ROC-SVM path object.
rocsvm.get.solution(obj, lambda)rocsvm.get.solution(obj, lambda)
obj |
The rocsvm.path object |
lambda |
The regularization parameter that users want in ROC-SVM model. |
Seung Jun Shin, Do Hyun Kim
# library(rocsvm.path) # The 'obj' comes from an example description of rocsvm.path() rocsvm.get.solution(obj, lambda = 1)# library(rocsvm.path) # The 'obj' comes from an example description of rocsvm.path() rocsvm.get.solution(obj, lambda = 1)
Computes an intercept at a specific sensitivity or specificity level from the ROC-SVM model.
rocsvm.intercept(obj, lambda = 1, sensitivity = 0.5, specificity = 0.5)rocsvm.intercept(obj, lambda = 1, sensitivity = 0.5, specificity = 0.5)
obj |
The rocsvm.path object |
lambda |
The regularization parameter that users want in ROC-SVM model. |
sensitivity |
Sensitivity in ROC curve, which means True Positive Rate (TPR). |
specificity |
Specificity in ROC curve, which means True Negative Rate (TNR) = 1-FPR. |
Seung Jun Shin, Do Hyun Kim
# library(rocsvm.path) # The 'obj' comes from an example description of rocsvm.path() rocsvm.intercept(obj, lambda = 1, sensitivity = 0.9, specificity = 0.1)# library(rocsvm.path) # The 'obj' comes from an example description of rocsvm.path() rocsvm.intercept(obj, lambda = 1, sensitivity = 0.9, specificity = 0.1)
This algorithm computes the entire regularization path for the ROC-Support Vector Machine with a relatively low cost compared to quadratic programming problem.
rocsvm.path(x, y, rho = 1, kernel = poly.kernel, param.kernel = 1, prop = 0.5, lambda.min = 1e-05, eps = 1e-05, Nmoves = 500)rocsvm.path(x, y, rho = 1, kernel = poly.kernel, param.kernel = 1, prop = 0.5, lambda.min = 1e-05, eps = 1e-05, Nmoves = 500)
x |
The data matrix (n x p) with n rows (observations) on p variables (columns) |
y |
The |
rho |
A positive constant |
kernel |
This is a user-defined function. Provided options are polynomial kernel; |
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" |
prop |
The proportion of large class corresponding a point of small class by speed-up tricks (the default is |
lambda.min |
The smallest value of lambda for termination of the algorithm (the default is |
eps |
An adjustment computing errors |
Nmoves |
The maximum number of iterations the rocsvm.path algorithm |
A 'rocsvm.path' object is returned, for which there are lambda values and corresponding values of alpha for each data point.
Seung Jun Shin, Do Hyun Kim
rocsvm.get.solution, plot.rocsvm, rocsvm.intercept
library(rocsvm.path) n <- 30 p <- 2 delta <- 1 set.seed(309) y <- c(rep(1, n/2), rep(-1, n/2)) x <- matrix(0, n, p) for (i in 1:n){ if (y[i] == 1) { x[i,] <- rnorm(p, -delta, 1) } else { x[i,] <- rnorm(p, delta, 1) } } rho = 1 kernel = radial.kernel param.kernel = 1/ncol(x) prop = 0.1 obj <- rocsvm.path(x, y, rho, kernel, param.kernel, prop)library(rocsvm.path) n <- 30 p <- 2 delta <- 1 set.seed(309) y <- c(rep(1, n/2), rep(-1, n/2)) x <- matrix(0, n, p) for (i in 1:n){ if (y[i] == 1) { x[i,] <- rnorm(p, -delta, 1) } else { x[i,] <- rnorm(p, delta, 1) } } rho = 1 kernel = radial.kernel param.kernel = 1/ncol(x) prop = 0.1 obj <- rocsvm.path(x, y, rho, kernel, param.kernel, prop)
Computes the Lagrangian multipliers(alpha), which are solutions of ROC-SVM using Quadratic Programming.
rocsvm.solve(K, lambda, rho = 1, eps = 1e-08)rocsvm.solve(K, lambda, rho = 1, eps = 1e-08)
K |
The kernelized matrix, i.e., K< .,. >. |
lambda |
The regularization parameter that users want in ROC-SVM model. |
rho |
A positive constant (default : 1) |
eps |
Adjustment computing errors (default : 1e-08) |
Seung Jun Shin, Do Hyun Kim
n <- 30 p <- 2 delta <- 1 set.seed(309) y <- c(rep(1, n/2), rep(-1, n/2)) x <- matrix(0, n, p) for (i in 1:n){ if (y[i] == 1) { x[i,] <- rnorm(p, -delta, 1) } else { x[i,] <- rnorm(p, delta, 1) } } K <- radial.kernel(x,x) rocsvm.solve(K, lambda = 1, rho = 1)n <- 30 p <- 2 delta <- 1 set.seed(309) y <- c(rep(1, n/2), rep(-1, n/2)) x <- matrix(0, n, p) for (i in 1:n){ if (y[i] == 1) { x[i,] <- rnorm(p, -delta, 1) } else { x[i,] <- rnorm(p, delta, 1) } } K <- radial.kernel(x,x) rocsvm.solve(K, lambda = 1, rho = 1)