print.q.svmmaj | R Documentation |
SVM-Maj is an algorithm to compute a support vector machine (SVM) solution.
In its most simple form, it aims at finding hyperplane that optimally
separates two given classes. This objective is equivalent to finding a
linear combination of k
predictor variables to predict the two
classes for n
observations. SVM-Maj minimizes the standard support
vector machine (SVM) loss function. The algorithm uses three efficient
updates for three different situations: primal method which is efficient in
the case of n > k
, the decomposition method, used when the matrix of
predictor variables is not of full rank, and a dual method, that is
efficient when n < k
. Apart from the standard absolute hinge error,
SVM-Maj can also handle the quadratic and the Huber hinge.
## S3 method for class 'q.svmmaj'
print(x, ...)
svmmaj(
X,
y,
lambda = 1,
weights.obs = 1,
weights.var = 1,
scale = c("interval", "zscore", "none"),
spline.knots = 0,
spline.degree = 1L,
kernel = vanilladot,
kernel.sigma = 1,
kernel.scale = 1,
kernel.degree = 1,
kernel.offset = 1,
hinge = c("absolute", "quadratic", "huber", "logitistic"),
hinge.delta = 1e-08,
options = setSVMoptions(),
initial.point = NULL,
verbose = FALSE,
na.action = na.omit,
...
)
## Default S3 method:
svmmaj(
X,
y,
lambda = 1,
weights.obs = 1,
weights.var = 1,
scale = c("interval", "zscore", "none"),
spline.knots = 0,
spline.degree = 1L,
kernel = vanilladot,
kernel.sigma = 1,
kernel.scale = 1,
kernel.degree = 1,
kernel.offset = 1,
hinge = c("absolute", "quadratic", "huber", "logitistic"),
hinge.delta = 1e-08,
options = setSVMoptions(),
initial.point = NULL,
verbose = FALSE,
na.action = na.omit,
...
)
x |
the |
... |
Other arguments passed to methods. |
X |
A data frame (or object coercible by
|
y |
A factor (or object coercible by |
lambda |
Regularization parameter of the penalty term. |
weights.obs |
a vector of length |
weights.var |
a vector of length |
scale |
Specifies whether the columns of attribute matrix |
spline.knots |
equals the number of internal knots of the spline basis.
When the number of knots exceeds the number of (categorical) values of
an explanatory variable, the duplicate knots will be removed using
|
spline.degree |
equals the polynomial degree of the splines,
for no splines: |
kernel |
Specifies which kernel function to be used (see
|
kernel.sigma |
additional parameters used for the kernel function
(see |
kernel.scale |
additional parameters used for the kernel function
(see |
kernel.degree |
additional parameters used for the kernel function
(see |
kernel.offset |
additional parameters used for the kernel function
(see |
hinge |
Specifies with hinge function from
|
hinge.delta |
The parameter of the huber hinge
(only if |
options |
additional settings used in the |
initial.point |
Initial solution. |
verbose |
|
na.action |
Generic function for handling NA values. |
The following settings can be added as element in the options
parameter:
decomposition
Specifies whether the QR decomposition should be used
for efficient updates. Possible values are 'svd'
for Singular value
decomposition (Eigenvalue decomposition for non-linear kernel) or
'chol'
for Cholesky (or QR decomposition in case of linear kernel)
convergence
Specifies the convergence criterion of the algorithm.
Default is 1e-08
.
increase.step
The iteration number from which relaxed update will be
used.
eps
The relaxation of the majorization function for absolute hinge:
.25 * eps^-1
is the maximum steepness of the majorization function.
check.positive
Specifies whether a check has to be made for positive
input values.
max.iter
maximum number of iterations to use
Returns a svmmaj-class object,
of which the methods plot
,
plotWeights
, summary
and predict
can be applied.
(see also predict.svmmaj
and
print.svmmaj
)
Hok San Yip, Patrick J.F. Groenen, Georgi Nalbantov
P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVM-Maj: a majorization approach to linear support vector machines with different hinge errors.
dots
for the computations of the kernels.
predict.svmmaj
normalize
isb
getHinge
## using default settings
model1 <- svmmaj(
diabetes$X, diabetes$y, hinge = 'quadratic', lambda = 1)
summary(model1)
weights.obs = list(positive = 2, negative = 1)
## using radial basis kernel
library(kernlab)
model2 <- svmmaj(
diabetes$X, diabetes$y, hinge = 'quadratic', lambda = 1,
weights.obs = weights.obs, scale = 'interval',
kernel = rbfdot,
kernel.sigma = 1
)
summary(model2)
## I-spline basis
library(ggplot2)
model3 <- svmmaj(
diabetes$X, diabetes$y, weight.obs = weight.obs,
spline.knots = 3, spline.degree = 2
)
plotWeights(model3, plotdim = c(2, 4))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.