liblinear-train - train a linear classifier and produce a model

Synopsis

Description

Options

Examples

See Also

Authors

liblinear-train[options]training_set_file[model_file]

liblinear-traintrains a linear classifier using liblinear and produces a model suitable for use withliblinear-predict(1).

training_set_fileis the file containing the data used for training.model_fileis the file to which the model will be saved. Ifmodel_fileis not provided, it defaults totraining_set_file.model.To obtain good performances, sometimes one needs to scale the data. This can be done with

svm-scale(1).

A summary of options is included below.

-stypeSet the type of the solver:

0 ... L2-regularized logistic regression1 ... L2-regularized L2-loss support vector classification (dual) (default)

2 ... L2-regularized L2-loss support vector classification (primal)

3 ... L2-regularized L1-loss support vector classification (dual)

4 ... multi-class support vector classification

5 ... L1-regularized L2-loss support vector classification

6 ... L1-regularized logistic regression

7 ... L2-regularized logistic regression (dual)

-ccostSet the parameter C (default: 1)-eepsilonSet the tolerance of the termination criterion For -s 0 and 2:

|f’(w)|_2 <=

epsilon*min(pos,neg)/l*|f’(w0)_2, where f is the primal function and pos/neg are the number of positive/negative data (default:0.01)For -s 1, 3, 4 and 7:

Dual maximal violation <= epsilon; similar to libsvm (default:0.1)For -s 5 and 6:

|f’(w)|_inf <= epsilon*min(pos,neg)/l*|f’(w0)|_inf, where f is the primal function (default:0.01)-BbiasIf bias>= 0, then instance x becomes [x; bias]; ifbias< 0, then no bias term is added (default:-1)-wiweightWeight-adjusts the parameter C of class iby the valueweight-vnn-fold cross validation mode-qQuiet mode (no outputs).

Train a linear SVM using L2-loss function:

liblinear-train data_fileTrain a logistic regression model:

liblinear-train -s 0 data_fileDo five-fold cross-validation using L2-loss SVM, using a smaller stopping tolerance 0.001 instead of the default 0.1 for more accurate solutions:

liblinear-train -v 5 -e 0.001 data_fileTrain four classifiers:

positive negative Cp Cn

class 1 class 2,3,4 20 10

class 2 class 1,3,4 50 10

class 3 class 1,2,4 20 10

class 4 class 1,2,3 10 10

liblinear-train -c 10 -w1 2 -w2 5 -w3 2 four_class_data_fileIf there are only two classes, we train ONE model. The C values for the two classes are 10 and 50:

liblinear-train -c 10 -w3 1 -w2 5 two_class_data_fileOutput probability estimates (for logistic regression only) using

liblinear-predict(1):

liblinear-predict -b 1 test_file data_file.model output_file

liblinear-predict(1),svm-predict(1),svm-train(1)

liblinear-train was written by the LIBLINEAR authors at National Taiwan university for the LIBLINEAR Project.This manual page was written by Christian Kastner <debian@kvr.at>, for the Debian project (and may be used by others).

LIBLINEAR-TRAIN (1) | March 08, 2011 |