1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
\" Hey, EMACS: -*- nroff -*-
.TH LIBLINEAR-TRAIN 1 "October 21, 2019"
.SH NAME
liblinear-train \- train a linear classifier and produce a model
.SH SYNOPSIS
.B liblinear-train
.RI [ options ] " training_set_file " [ model_file ]
.br
.SH DESCRIPTION
\fBliblinear-train\fP trains a linear classifier using liblinear and produces a
model suitable for use with \fBliblinear-predict\fP(1).
\fItraining_set_file\fP is the file containing the data used for training.
\fImodel_file\fP is the file to which the model will be saved. If
\fImodel_file\fP is not provided, it defaults to \fItraining_set_file.model\fP.
To obtain good performances, sometimes one needs to scale the data. This can be
done with \fBsvm-scale\fP(1).
.SH OPTIONS
A summary of options is included below.
.TP
.B \-s \fItype\fP
Set the type of the solver (default \fB1\fP):
.sp
.RS 8
.nf
for multi-class classification
.fi
.RE
.sp
.RS 10
.nf
0 ... L2-regularized logistic regression (primal)
.sp
1 ... L2-regularized L2-loss support vector classification (dual)
.sp
2 ... L2-regularized L2-loss support vector classification (primal)
.sp
3 ... L2-regularized L1-loss support vector classification (dual)
.sp
4 ... support vector classification by Crammer and Singer
.sp
5 ... L1-regularized L2-loss support vector classification
.sp
6 ... L1-regularized logistic regression
.sp
7 ... L2-regularized logistic regression (dual)
.sp
.fi
.RE
.RS 8
.nf
for regression
.fi
.RE
.sp
.RS 10
.nf
.sp
11 ... L2-regularized L2-loss support vector regression (primal)
.sp
12 ... L2-regularized L2-loss support vector regression (dual)
.sp
13 ... L2-regularized L1-loss support vector regression (dual)
.sp
.fi
.RE
.RS 8
.nf
for outlier detection
.fi
.RE
.sp
.RS 10
.nf
.sp
21 ... one\-class support vector machine (dual)
.fi
.RE
.TP
.B \-c \fIcost\fP
Set the parameter C (default: \fB1\fP)
.TP
.B \-p \fIepsilon\fP
Set the epsilon in loss function of epsilon-SVR (default: \fB0.1\fP)
.TP
.B \-e \fIepsilon\fP
Set the tolerance of the termination criterion
.TP
.B \-n \fInu\fP
Set the parameter nu of one-class SVM (default 0.5)
.sp
\-s 0 and 2:
.RS 10
.nf
.sp
|f'(w)|_2 <= \fIepsilon\fP*min(pos,neg)/l*|f'(w0)|_2, where f is
the primal function and pos/neg are the number of positive/negative data
(default: \fB0.01\fP)
.fi
.RE
.IP
\-s 11:
.sp
.nf
.RS 10
|f'(w)|_2 <= epsilon*|f'(w0)|_2 (default \fB0.0001\fP)
.fi
.RE
.IP
\-s 1, 3, 4, 7 and 21:
.sp
.nf
.RS 10
Dual maximal violation <= \fIepsilon\fP; similar to libsvm (default: \fB0.1\fP
except 0.01 for \-s 21)
.fi
.RE
.IP
\-s 5 and 6:
.sp
.nf
.RS 10
|f'(w)|_inf <= \fIepsilon\fP*min(pos,neg)/l*|f'(w0)|_inf, where f is the primal
function (default: \fB0.01\fP)
.RE
.IP
\-s 12 and 13:
.sp
.nf
.RS 10
|f'(alpha)|_1 <= epsilon |f'(alpha0)|, where f is the dual function (default \fB0.1\fP)
.RE
.TP
.B \-B \fIbias\fP
If \fIbias\fP >= 0, then instance x becomes [x; bias]; if \fIbias\fP < 0, then
no bias term is added (default: \fB-1\fP)
.TP
.B \-R
not regularize the bias; must with \-B 1 to have the bias; DON'T use this unless you
know what it is (for \-s 0, 2, 5, 6, 11)
.TP
.B \-w\fIi\fP \fIweight\fP
Weights adjust the parameter C of different classes (see README for details)
.TP
.B \-v \fIn\fP
\fIn\fP-fold cross validation mode
.TP
.B \-C
Find parameters (C for \-s 0, 2 and C, p for \-s 11)
.TP
.B \-q
Quiet mode (no outputs).
.fi
.RE
.sp
Option \-v randomly splits the data into n parts and calculates
cross validation accuracy on them.
Option \-C conducts cross validation under different parameters and finds
the best one. This option is supported only by \-s 0, \-s 2 (for finding C)
and \-s 11 (for finding C, p). If the solver is not specified, \-s 2 is used.
.SH EXAMPLES
.sp
Train a linear SVM using L2-loss function:
.sp
.RS 10
.nf
liblinear-train data_file
.fi
.RE
.sp
Train a logistic regression model:
.sp
.RS 10
.nf
liblinear-train \-s 0 data_file
.fi
.RE
.sp
Train a linear one\-class SVM which selects roughly 10% data as outliers.
.sp
.RS 10
.nf
liblinear-train -s 21 -n 0.1 data_file
.fi
.RE
.sp
Do five-fold cross-validation using L2-loss SVM. Use a smaller stopping
tolerance 0.001 than the default 0.1 if you want more accurate solutions:
.sp
.RS 10
.nf
liblinear-train \-v 5 \-e 0.001 data_file
.fi
.RE
.sp
Conduct cross validation many times by L2-loss SVM and find the parameter
C which achieves the best cross validation accuracy:
.sp
.RS 10
.nf
train \-C datafile
.fi
.RE
.sp
For parameter selection by \-C, users can specify other
solvers (currently \-s 0, \-s 2 and \-s 11 are supported) and
different number of CV folds. Further, users can use
the \-c option to specify the smallest C value of the
search range. This option is useful when users want to
rerun the parameter selection procedure from a specified
C under a different setting, such as a stricter stopping
tolerance \-e 0.0001 in the above example. Similarly, for
\-s 11, users can use the \-p option to specify the
maximal p value of the search range.
.sp
.RS 10
.nf
train \-C \-s 0 \-v 3 \-c 0.5 \-e 0.0001 datafile
.fi
.RE
.sp
Train four classifiers:
.RS 18
.sp
positive negative Cp Cn
.br
class 1 class 2,3,4 20 10
.br
class 2 class 1,3,4 50 10
.br
class 3 class 1,2,4 20 10
.br
class 4 class 1,2,3 10 10
.RE
.sp
.RS 10
.nf
liblinear-train \-c 10 \-w1 2 \-w2 5 \-w3 2 four_class_data_file
.fi
.RE
.sp
If there are only two classes, we train ONE model. The C values for the two
classes are 10 and 50:
.sp
.RS 10
.nf
liblinear-train \-c 10 \-w3 1 \-w2 5 two_class_data_file
.fi
.RE
.sp
Output probability estimates (for logistic regression only) using
\fBliblinear-predict\fP(1):
.sp
.RS 10
.nf
liblinear-predict \-b 1 test_file data_file.model output_file
.fi
.RE
.SH SEE ALSO
.BR liblinear-predict (1),
.BR svm-predict (1),
.BR svm-train (1),
.BR svm-scale (1)
.SH AUTHORS
liblinear-train was written by the LIBLINEAR authors at National Taiwan
university for the LIBLINEAR Project.
.PP
This manual page was written by Christian Kastner <ckk@debian.org>
for the Debian project (and may be used by others).
|