I am trying to implement one vs rest multiclass classification using LIBSVM.

The function is as below:

function [pred, ac, decv] = ovrpredict(y, x, model)

labelSet = model.labelSet;

labelSetSize = length(labelSet);

models = model.models;

decv= zeros(size(y, 1), labelSetSize);

for i=1:labelSetSize

[l,a,d] = svmpredict(double(y == labelSet(i)), x, models{i});

decv(:, i) = d * (2 * models{i}.Label(1) - 1); % ERROR IN THIS LINE

end

[tmp,pred] = max(decv, [], 2);

pred = labelSet(pred);

ac = sum(y==pred) / size(x, 1);

The error message I get is Attempt to reference field of non-structure array.

Reference to non-existent field 'Label'.

Any suggestions will be really helpful.

More Alaa S. Al-Waisy's questions See All
Similar questions and discussions