Description Usage Arguments Details Value Examples
svm.admm
is a simple function for solving large-scale regularized linear/nonlinear
classification by using ADMM and IADMM algorithms. This function provides
linear L2-regularized primal classification (both ADMM and IADMM are available),
kernel L2-regularized dual classification (IADMM) as well as L1-regularized primal
classification (both ADMM and IADMM are available). The training of the models perform well
practice.
1 2 3 |
x.tr |
a n*p data matrix. Each row stands for an example (sample, point) and each column stands for a dimension (feature, variable). |
y.tr |
a n-length vector. The values correspond to class labels. |
type |
|
kernel |
the kernel used in training and predicting when
|
sigma |
The inverse kernel width used by the Gaussian. |
degree |
The degree of the polynomial kernel function. This has to be an positive integer. |
scale |
The scaling parameter of the polynomial kernel is a convenient way of normalizing patterns without the need to modify the data itself. |
offset |
The offset used in a polynomial kernel. |
algo |
the algorithm to solve the problem w.r.t. |
lambda |
regularization constant (default: 1). Rules the trade-off
between regularization and correct classification on |
rho |
regularization constant (default: 1). |
eps |
epsilon in the termination condition. |
svmadmm
internally computing kernel matrix when type
is 0, which is based by the package kernlab.
An list containing the fitted model, including:
alpha |
A solution for dual form svm classification. |
beta |
A solution for primal form svm classifciation, also are the model weights. |
type |
An integer correspinding to |
kernel |
A function to define the kernel. |
x.tr |
The training input data. |
y.tr |
The training output data. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(svmadmm)
n = 100
p = 10
x = matrix(runif(2 * n * p, -1, 1), nrow = 2 * n)
y = sign(x[, 1])
y.ind = sample(1 : (2 * n), n / 10, replace = FALSE)
y[y.ind] = - y[y.ind]
x.tr = x[1 : n, ]
y.tr = y[1 : n]
x.te = x[-(1 : n), ]
y.te = y[-(1 : n)]
model = svm.admm(x.tr, y.tr)
fit = svm.predict(x.te, model)
|
Loading required package: kernlab
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.