SVM modified objective function formulation

Dears, I need to implement the following objective function:

This objective function implements the SOFT-LABEL SVM, since my dataset don’t has labels. More information about the method can be found in
https://www.ecse.rpi.edu/~cvrl/Publication/pdf/Zhao2016b.pdf.

My code:

function [ w,b ] = optimization(X,P)

  [N,m] = size(X);

  hingeLoss = @(y,svm) max(0, 1 - y.*svm);

  svm_function = @(w,x,b) w*x + b;

  gama = 1;

  cvx_begin 
    variables w(m,1) b 
    obj1 = 0.5.*norm(w,2);
    obj2 = 0;
    for k=1:2,
       for j=1:N,
         obj2 = ...
         obj2 + ...
         gama.*P(j,k).*sum(hingeLoss((-1).^(k),               
         svm_function(w,X(j,:),b)));
        end,
    end
    obj = obj1 + sum(obj2);
    minimize(obj)
    cvx_end

end
 

It's running, but the w vector has repeated values. I'm not sure if my code it's correct. Thanks!