Description Usage Arguments Value Author(s) References See Also Examples
View source: R/svmmaj2.r View source: R/svmmaj.R
SVMMaj 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.
SVMMaj 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, SVMMaj can also handle the
quadratic and the Huber hinge.
1 2 3 4 5 6 7 8 9 10 11  svmmaj(X,y,lambda=1,...)
## Default S3 method:
svmmaj(X, y, lambda=1, weights.obs = 1, weights.var= 1, scale = 'none',
spline.knots=0L, spline.degree=1L, kernel=vanilladot, kernel.sigma=1, kernel.degree=1,
kernel.scale=1, kernel.offset=0, hinge='absolute', hinge.k=5, convergence=1e8,
print.step=FALSE, initial.point=NULL, increase.step = 20, eps=1e8,
check.positive=TRUE,na.action=na.omit,...)
plotWeights(object,plotdim=c(3,3))
## S3 method for class 'svmmaj'
plot(x,titletext=NULL,...)

X 
A data frame (or object coercible by 
y 
A factor (or object coercible by 
lambda 
Regularization parameter of the penalty term. 
weights.obs 
Vector of length 
weights.var 
Vector of length 
scale 
Specifies whether the columns of attribute matrix 
spline.knots 
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 
The polynomial degree of the splines, for no splines:

kernel 
Specifies which kernel function to be used (see 
kernel.sigma 
The kernel parameter 
kernel.degree 
The degree parameter of the polynomial kernel (see 
kernel.scale 
The scale parameter of the polynomial kernel (see 
kernel.offset 
The offset used in a polynomial kernel ( 
hinge 
Specifies which hinge term to be used. Possible values are:

hinge.k 
The parameter of the huber hinge, if the huber hinge is used. 
convergence 
Specifies the convergence criterion of the algorithm. Default is 
print.step 

initial.point 
Initial solution. 
increase.step 
The iteration number from which relaxed update will be used. 
eps 
The relaxation of the majorization function for absolute hinge: 
check.positive 
Specifies whether a check has to be made for positive input values. 
na.action 
Generic function for handling NA values. 
object 
The model returned from 
x 
The model returned from 
titletext 
An optional title for 
plotdim 
A vector of the form 
... 
Other arguments passed to methods. 
Returns a svmmaj
class, of which the methods plot
, plotWeights
, summary
and predict
can be applied.
(see also predict.svmmaj
)
The returning object consist of the following values:
call 
The function specifications which has been called. 
lambda 
The regularization parameter of the penalty term which has been used. 
loss 
The corresponding loss function value of the final solution. 
iteration 
Number of iterations needed to evaluate the algorithm. 
X 
The attribute matrix of 
y 
The vector of length 
classes 
A vector of length 
Xtrans 
The attribute matrix 
norm.param 
The applied normalization parameters (see 
splineInterval 
The spline knots which has been used (see 
splineLength 
Denotes the number of spline basis of each explanatory variable in 
method 
The decomposition matrices used in estimating the model. 
hinge 
The hinge function which has been used (see 
beta 
If identified, the beta parameters for the linear combination (only available for linear kernel). 
q 
A vector of length 
nSV 
Number of support vectors. 
plotWeights
shows, one graph per attribute, the weights of all attributes. The type of graph depends on the
type of the attribute: the spline line of the corresponding attribute in case a spline has been used, a bar plot for
categorical and logical values, and a linear line for all other type of the attribute values. This function cannot be
used in a model with a nonlinear kernel.
Hok San Yip, Patrick J.F. Groenen, Georgi Nalbantov
P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVMMaj: a majorization approah to linear support vector machines with different hinge errors.
dots
for the computations of the kernels.
predict.svmmaj
normalize
isb
hinge
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  attach(diabetes)
## using default settings
model1 < model < svmmaj(X,y,hinge='quadratic', lambda=1)
summary(model1)
weights.obs = list(positive=2,negative=1)
## using radial basis kernel
model2 < svmmaj(X,y,hinge='quadratic', lambda=1, weights.obs=weights.obs,
standardize='interval',kernel=rbfdot,
kernel.sigma=1)
summary(model2)
## Ispline basis
model3 < svmmaj(X,y,,weights.obs=weights.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.