View Single Post
Old 05-21-2012, 09:36 PM
sakumar sakumar is offline
Join Date: Apr 2012
Posts: 40
Default Re: What Quadratic Programming Package?

Originally Posted by kurts View Post
Here's the setup that I used for the qp function

    n = length(X(:,1)); % How many points
    d = length(X(1,:)); % Dimensionality of X
    H = zeros(n,n);
    L = ones(n,1);
    L = -1.*L;       % Linear term is tall vector of -1
    lb = zeros(n,1); % Lower bound on alpha is tall vector of 0
    A = Y';          % Linear coefficient  (A)(alpha) + blin = 0
    blin = 0;        % 
    for i = 1:n;
        for j = 1:n;
            H(i,j) = Y(i)*Y(j)*X(j,:)*X(i,:)';

    [alpha, obj, info, lambda] = qp([],H,L,A,blin,lb,[]);
I used pretty much the same setup, but with alpha0 = 1 to start with.

However, did you check the return code? I always get a 3 even if I increase the number of iterations from the default of 200 to 1000 (options.MaxIter = 1000). Code 3 just means that maximum number of iterations reached. I can see pretty decent support vectors though, so I'm hoping that's OK.
Reply With Quote