Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svmtrain in matlab - the constraints are not restrictive enough.

Tags:

kernel

matlab

svm

I am using svmtrain in matlab with MLP kernel like this:

mlp=svmtrain(train_data,train_label,'Kernel_Function','mlp','showplot',true);

But I get this error:

??? Error using ==> svmtrain at 470
Unable to solve the optimization problem:
Exiting: the solution is unbounded and at infinity;
the constraints are not restrictive enough.

What is the reason? I tried other kernels, there was not any error. Even I tried the answer of svmtrain - unable to solve the optimization problem as follows:

options = optimset('maxiter',1000);
svmtrain(train_data,train_label,'Kernel_Function','mlp','Method','QP',...
'quadprog_opts',options);

but again I have got the same error. My training set is a simple 45*2 data set of 2 class data points.

like image 539
Tyb Rafiei Avatar asked Nov 12 '22 14:11

Tyb Rafiei


1 Answers

The solution in here doesn't really explain anything. The problem is that the Quadratic Programming method fails to converge on the optimisation problem. The normal course of action is to increase the number of iterations, but I have tested this on the same sized data, with 1,000,000 iterations, and it still fails to converge.

options = optimset('maxIter',1000000);

mlp = svmtrain(data,labels,'Kernel_Function','mlp','Method','QP',...
'quadprog_opts',options); 

??? Error using ==> svmtrain at 576
Unable to solve the optimization problem:
Exiting: the solution is unbounded and at infinity;
 the constraints are not restrictive enough.

My question is: is there any reason you are using Quadratic Programming over SMO for your optimisation? Doing exactly the same thing using SMO works fine:

mlp = svmtrain(data,labels,'Kernel_Function','mlp','Method','SMO');

mlp = 

          SupportVectors: [40x2 double]
                   Alpha: [40x1 double]
                    Bias: 0.0404
          KernelFunction: @mlp_kernel
      KernelFunctionArgs: {}
              GroupNames: [45x1 double]
    SupportVectorIndices: [40x1 double]
               ScaleData: [1x1 struct]
           FigureHandles: []
like image 182
Will Faithfull Avatar answered Nov 15 '22 09:11

Will Faithfull