www.pudn.com > snippets(1).rar > classify_ova.m, change:2009-10-12,size:371b


function [result,strength] = classify_ova(classifier, test_data)
%
% classify test data with a bank of 2-class SVMs (one-vs-all)

num_classes = length(classifier);
num_data = size(test_data,1);

strength = zeros(num_data, num_classes);

for u = 1:num_classes
  [curr_class, strength(:,u)] = svmfwd(classifier{u}, test_data);
end

[maxval, result] = max(strength, [], 2);