Description: Train a support vector machine using a simple iterative update procedure first described by Tommi Jaakkola.
Usage: compute-weights [options] -train <filename> -class <filename> -label <name>
Input:
- -train <filename> - an RDB file of training examples. The first column contains labels, and the remaining columns containing real-valued features.
- -class <filename> - a two-column RDB file of training set labels. This file must contain exactly the same number of lines as the training data file. The first column contains labels, which must appear in the same order as in the training data file. The second column contains a binary classification (1 or -1).
- -label <name> - the label that appears in the first row, first column of the training data and label files. This parameter is admittedly useless and will be removed from future versions of the program.
Output: A two-column RDB file similar to the classification file, except that the second column contains learned weights for the SVM. This output is suitable for input to classify.
Options:
The following five options modify the base kernel function. The operations occur in the order listed below.
- -matrix - By default, the base kernel function is a dot product. This option allows that function to be replaced by an arbitrary function. Read a kernel matrix, rather than training set examples, from the file specified by '-train'. The matrix is an n+1 by n+1 RDB matrix, where n is the number of training examples. The first row and column contain data labels. The matrix entry for row x, column y, contains the kernel value K(x,y).
- -normalize - Normalize the kernel matrix by dividing K(x,y) by sqrt(K(x,x) * K(y,y)).
- -constant <value> - Add a given constant to the kernel. The default constant is 1.
- -coefficient <value> - Multiply the kernel by a given coefficient. The default coefficient is 1.
- -power <value> - Raise the kernel to a given power. The default power is 1.
- -radial - Convert the kernel to a radial basis function. If K is the base kernel, this option creates a kernel of the form exp[(-D(x,y)2)/(2 w2)], where w is the width of the kernel (see below) and D(x,y) is the distance between x and y, defined as D(x,y) = sqrt[K(x,x)2 - 2 K(x,y) + K(y,y)2].
- -widthfactor <value> - The width w of the radial basis kernel is set using a heuristic: it is the median of the distance from each positive training point to the nearest negative training point. This option specifies a multiplicative factor to be applied to that width.
- -noconstraint - Do not place an upper bound on the magnitude of the weights. By default, the bound is set at 1.
- -posconstraint <value> - Set an explicit upper bound on the magnitude of the weights for positive training examples. The default bound is 1.
- -negconstraint <value> - Set an explicit upper bound on the magnitude of the weights for negative training examples. The default bound is 1.
- -diagfactor <value> - Add to the diagonal of the kernel matrix (n+/N) * m * k, where n+ is the number of positive training examples if the current example is positive (and similarly for negative training examples), N is the total number of training examples, m is the median value of the diagonal of the kernel matrix, and k is the value specified here.
- -noweights - Compute and print the kernel matrix to stdout. Do not compute the weights.
- -threshold <value> - Set the convergence threshold. Training halts when the objective function changes by less than this amount. Default is 0.00001.
- -seed <value> - Set the seed for the random number generator. By default the seed is set from the clock.
- -notime - Do not include timing information in the output header.
- -verbose 1|2|3|4|5 - Set the verbosity level of the output to stderr. The default level is 2.
Calls: cat, column, headchg, awk