# lpSVM: Linearly Programmed SVM In bmrm: Bundle Methods for Regularized Risk Minimization Package

## Description

Linearly Programmed L1-loss Linear Support Vector Machine with L1 regularization

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```svmLP(x, y, LAMBDA = 1, loss.weights = 1) ## S3 method for class 'svmLP' predict(object, x, ...) svmMulticlassLP(x, y, LAMBDA = 1, loss.weights = 1) ## S3 method for class 'svmMLP' predict(object, x, ...) ```

## Arguments

 `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

## Details

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

## Value

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"

## Functions

• `svmLP`: linear programm solving binary-SVM with L1-regularization and L1-norm

• `svmMulticlassLP`: linear programm solving multiclass-SVM with L1-regularization and L1-norm

## Examples

 ```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) ```

### Example output

```            y
setosa versicolor virginica
setosa         50          0         0
versicolor      0         48         1
virginica       0          2        49
y
setosa versicolor virginica
FALSE      0         50        50
TRUE      50          0         0
```

bmrm documentation built on May 2, 2019, 2:49 p.m.