Libsvm指数超出矩阵维度

时间:2015-05-25 17:21:30

标签: arrays matlab libsvm

以下libsvm matlab代码在几次循环后不断给出一个Index超过矩阵的维度。任何人都可以帮我解决错误的来源吗?

testlabel = [1 1 1 1 1 1 1 1 1 1; 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 0 0 0 0 0 0]; 

model = cell(3,1);
for n=1:3
    model{n} = svmtrain(completelabel{n}, completefeatureVector{n}, '-b 1 -t 0');
end

numTest=10;

pr = zeros(numTest,2);
for k=1:numTest
    for m=1:3
        [~,~,p] = svmpredict(testlabel(m, k), featureVectortest{k}, model{m}, '-b 1');
        pr(:,k) = p(:,model{m}.Label==m);    %# probability of class==k
    end
    [~,predictedLabel] = max(pr,[],2);
end

0 个答案:

没有答案