Description Usage Arguments Value Examples
Fit a structured angle-based multicategory support vector machine with reinforced multicategory loss.
1 2 3 4 5 6 7 | sramsvm(x = NULL, y, gamma = 0.5, valid_x = NULL, valid_y = NULL, nfolds = 5,
lambda_seq = 2^{seq(-10, 10, length.out = 100)},
lambda_theta_seq = 2^{seq(-10, 10, length.out = 100)},
kernel = c("linear", "gaussian", "gaussian2", "poly", "spline", "spline2", "spline-t"), kparam = 1,
scale = FALSE, criterion = c("0-1", "loss"),
isCombined = FALSE, cv_type = c("original", "osr"), type = c("type1", "type2"),
optModel = FALSE, nCores = 1, verbose = 1, ...)
|
x |
A n x p data matrix, where n is the number of observations and p is the number of variables. |
y |
A response variable with three and more labels. |
gamma |
The convex combination parameter of the loss function. |
valid_x |
A validation data matrix for selecting |
valid_y |
A validation response vector (optional). |
nfolds |
The number of folds for cross-validation. |
lambda_seq |
A sequence of regularization parameter to control a level of l_2-penalty. |
lambda_theta_seq |
A sequence of regularization parameter on theta's, which are weights for kernels. |
kernel |
A character string representing one of type of kernel. |
kparam |
A parameter needed for kernel. |
scale |
A logical indicating the variables to be scaled. |
criterion |
A type of criterion evaluating prediction performance of cross-validation. |
isCombined |
A logical. If |
cv_type |
A rule of selecting lambda_theta parameter. If |
type |
A type of optimization method for ramsvm. If |
optModel |
A logical. Whether to obtain the optimal classification model. |
nCores |
The number of cores to use for parallel computing. |
verbose |
A integer value. If |
... |
Other arguments that can be passed to ramsvm core function. |
An S3 object of class "sramsvm
" containing the following slots
opt_theta |
The theta vector at the optimal lambda_theta value. |
cstep_inform |
Information of c-step including cross-validation errors and optimal lambda value. |
theta_step_inform |
Information of theta-step including cross-validation errors and optimal lambda_theta value. |
opt_model |
If |
opt_valid_err |
If |
valid_err |
If |
cv_type |
A rule of selecting lambda_theta. |
call |
The call of |
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 | require(dbvsmsvm)
n = 100; p = 10;
data = dbvsmsvm:::sim_gen(n = n, p = p, type = "linear")
x = scale(data$x)
y = data$y
sigma = kernlab::sigest(y ~ x, scaled = FALSE)[3]
# Fit the SRAMSVM with the linear kernel
sram_linear = sramsvm(x = x, y = y, gamma = 0.5, nfolds = 5,
lambda_seq = 2^{seq(-20, 0, length.out = 100)},
lambda_theta_seq = 2^{seq(-20, 0, length.out = 100)},
kernel = "linear", scale = FALSE, criterion = "0-1",
isCombined = TRUE, cv_type = "osr", nCores = 1)
# Fit the SRAMSVM with the Gaussian kernel
sram_radial = sramsvm(x = x, y = y, gamma = 0.5, nfolds = 5,
lambda_seq = 2^{seq(-20, 0, length.out = 100)},
lambda_theta_seq = 2^{seq(-20, 0, length.out = 100)},
kernel = "gaussian", kparam = sigma, scale = FALSE, criterion = "0-1",
isCombined = TRUE, cv_type = "osr", nCores = 1)
# Fit the SRAMSVM with the Gaussian kernel with second-order interaction
sram_radial_interaction = sramsvm(x = x, y = y, gamma = 0.5, nfolds = 5,
lambda_seq = 2^{seq(-20, 0, length.out = 100)},
lambda_theta_seq = 2^{seq(-20, 0, length.out = 100)},
kernel = "gaussian2", kparam = sigma, scale = FALSE, criterion = "0-1",
isCombined = TRUE, cv_type = "osr", nCores = 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.