annotate toolboxes/SVM-light/Readme_optimization_relative_constraints.txt @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 Solving general optimization problems
Daniel@0 2 -------------------------------------
Daniel@0 3
Daniel@0 4 You can use SVM-light to solve general optimzation problems of the form:
Daniel@0 5
Daniel@0 6 min 0.5 w*w + C sum_i C_i \xi_i
Daniel@0 7 s.t. x_i * w > rhs_i - \xi_i
Daniel@0 8
Daniel@0 9 Use the option "-z o". This allows specifying a training set where the examples are the inequality constraints. For example, to specify the problem
Daniel@0 10
Daniel@0 11 min 0.5 w*w + 10 (1000 \xi_1 + 1 \xi_2 + 1 \xi_3 + 1 \xi_4)
Daniel@0 12 s.t. 1 w_1 >= 0 - \xi_1
Daniel@0 13 -2 w_1 >= 1 - \xi_2
Daniel@0 14 2 w_3 >= 2 - \xi_3
Daniel@0 15 2 w_2 + 1 w_3 >= 3 - \xi_4
Daniel@0 16
Daniel@0 17 you can use the training set
Daniel@0 18
Daniel@0 19 0 cost:10000 1:1
Daniel@0 20 1 1:-2
Daniel@0 21 2 3:2
Daniel@0 22 3 2:3 3:1
Daniel@0 23
Daniel@0 24 and run
Daniel@0 25
Daniel@0 26 svm_learn -c 10 -z o train.dat model
Daniel@0 27
Daniel@0 28 The format is just like the normal SVM-light format. Each line corresponds to one inequality. However, the first element of each line is the right-hand side of the inequality. The remainder of the line specifies the left-hand side. The parameter cost:<value> is optional and lets you specify a factor by which the value of the slack variable is weighted in the objective. The general regularization parameter (10 in the example) is specified with the option -c <value> on the command line.
Daniel@0 29
Daniel@0 30 To classify new inequalities, you can use svm_classify in the normal way.