Title: | Reinforced Angle-Based Multicategory Support Vector Machines |
---|---|
Description: | Provides a solution path for Reinforced Angle-based Multicategory Support Vector Machines, with linear learning, polynomial learning, and Gaussian kernel learning. C. Zhang, Y. Liu, J. Wang and H. Zhu. (2016) <doi:10.1080/10618600.2015.1043010>. |
Authors: | Chong Zhang, Yufeng Liu, and Shannon T. Holloway |
Maintainer: | Shannon T. Holloway <[email protected]> |
License: | GPL-2 |
Version: | 2.3 |
Built: | 2024-11-06 03:41:05 UTC |
Source: | https://github.com/cran/ramsvm |
This function provides predictions on a test data set using the obtained classifier from a call of the ramsvm function.
## S4 method for signature 'ramsvm' predict(object,newdata=NULL,lambda=NULL,...)
## S4 method for signature 'ramsvm' predict(object,newdata=NULL,lambda=NULL,...)
object |
An object returned by the "ramsvm" function. |
newdata |
The new predictor matrix. The number and order of predictors in newdata should be the same as those of x, which is used in the ramsvm function. If not specified, the program uses the training x matrix as the prediction object. |
lambda |
The lambda values on which the user wants to predict. If not specified, the program will use the lambda values returned by the ramsvm function. |
... |
Not used. |
pred.y |
A prediction is made for each lambda value. |
Chong Zhang, Yufeng Liu, and Shannon Holloway
C. Zhang, Y. Liu, J. Wang and H. Zhu. (2016). Reinforced Angle-based Multicategory Support Vector Machines. Journal of Computational and Graphical Statistics, 25, 806-825.
data(iris) a <- ramsvm(x = as.matrix(iris[,-5]), y = iris[,5], lambda = 0.2, kernel="gaussian") predict(a)
data(iris) a <- ramsvm(x = as.matrix(iris[,-5]), y = iris[,5], lambda = 0.2, kernel="gaussian") predict(a)
A function that provides the RAMSVMs classifier for linear learning, polynomial learning, and kernel learning.
ramsvm(x, y, lambda, gamma = 0.5, weight = NULL, kernel = "linear", kparam = NULL, large = FALSE, epsilon = NULL, warm = NULL, nb.core=NULL)
ramsvm(x, y, lambda, gamma = 0.5, weight = NULL, kernel = "linear", kparam = NULL, large = FALSE, epsilon = NULL, warm = NULL, nb.core=NULL)
x |
The x matrix for the training dataset. Columns represent the covariates, and rows represent the instances. There should be no NA/NaN values in x. |
y |
The labels for the training dataset. |
gamma |
The convex combination parameter of the loss function. |
weight |
The weight vector for each observation. By default, the program uses equal weights for all observations. |
lambda |
The user specified lambda values. |
kernel |
The kernel for classification. |
kparam |
The kernel parameter. If kernel=linear, this option is ignored. For kernel=polynomial, it is the order of the polynomial functions. For kernel=gaussian, it is the Gaussian kernel parameter. |
large |
Whether the number of observations is large in the data. If TRUE, then the algorithm will split the data set into several parts and train on each part to provide a warm start for the entire data training. This option aims to enhance the computational speed. |
epsilon |
Convergence threshold in coordinate descent circling algorithm. The smaller epsilon is, the more accurate the final model is, and the more time it takes for calculation. Default is (0.0001*number of observations*number of classes). |
warm |
A matrix that contains the warm start for slack variables alpha. This option is especially useful when the user wishes to obtain the classifier with higher level accuracy (smaller epsilon) or with a different lambda, if the warm start is available from an existing ramsvm output. |
nb.core |
The number of threads to use for parallel computing. If null, the code will automatically detect and use the number of CPU cores. This option is used only when large=TRUE. |
An object of class ramsvm is returned.
If kernel=linear, this S4 object contains the following:
x |
A copy of the input covariate matrix. |
y |
A copy of the input labels. |
y.name |
The class names of y. |
k |
Number of classes in the classification problems. |
gamma |
A copy of the convex combination parameter of the loss function. |
weight |
The weight vector for each observation. |
lambda |
The lambda vector of all lambdas in the solution path. |
beta |
A list of matrices containing the estimated parameters of the classification function. Each matrix in the list corresponds to the lambda value in the solution path in order. For one single matrix, the rows correspond to a specific predictor. |
beta0 |
A list of the intercepts of the classification function. Each vector in the list corresponds to the lambda in the solution path in order. |
epsilon |
Convergence threshold in coordinate descent circling algorithm. |
call |
The call of ramsvm. |
If kernel != linear the S4 object also contains the following:
kernel |
The kernel for classification. |
kparam |
The kernel parameter. |
Chong Zhang, Yufeng Liu, and Shannon Holloway
C. Zhang, Y. Liu, J. Wang and H. Zhu. (2016). Reinforced Angle-based Multicategory Support Vector Machines. Journal of Computational and Graphical Statistics, 25, 806-825.
data(iris) ramsvm(x = as.matrix(iris[,-5]), y = iris[,5], lambda = 0.2, kernel="gaussian")
data(iris) ramsvm(x = as.matrix(iris[,-5]), y = iris[,5], lambda = 0.2, kernel="gaussian")