Description Usage Arguments Details Value Functions Author(s) Examples
Linearly Programmed L1-loss Linear Support Vector Machine with L1 regularization
1 2 3 4 5 6 7 8 9 |
x |
a numeric data matrix to predict |
y |
a response factor for each row of x. It must be a 2 levels factor for svmLP, or a >=2 levels factor for svmMulticlassLP |
LAMBDA |
control the regularization strength in the optimization process. This is the value used as coefficient of the regularization term. |
loss.weights |
numeric vector of loss weights to incure for each instance of x. Vector length should match length(y), but values are cycled if not of identical size. |
object |
an object of class svmLP or svmMLP |
... |
unused, present to satisfy the generic predict() prototype |
svmLP solves a linear program implementing a linear SVM with L1 regularization and L1 loss. It solves: min_w LAMBDA*|w| + sum_i(e_i); s.t. y_i * <w.x_i> >= 1-e_i; e_i >= 0 where |w| is the L1-norm of w
svmMulticlassLP solves a linear program implementing multiclass-SVM with L1 regularization and L1 loss. It solves: min_w LAMBDA*|w| + sum_i(e_i); s.t. <w.x_i> - <w.x_j> >= 1-e_i; e_i >= 0 where |w| is the L1-norm of w
the optimized weights matrix, with class svmLP
predict() return predictions for row of x, with an attribute "decision.value"
predict() return predictions for row of x, with an attribute "decision.value"
svmLP
: linear programm solving binary-SVM with L1-regularization and L1-norm
svmMulticlassLP
: linear programm solving multiclass-SVM with L1-regularization and L1-norm
Julien Prados
1 2 3 4 5 6 7 | x <- cbind(100,data.matrix(iris[1:4]))
y <- iris$Species
w <- svmMulticlassLP(x,y)
table(predict(w,x),y)
w <- svmLP(x,y=="setosa")
table(predict(w,x),y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.