Naive Bayes Classifier

by

 

Script for Naive Bayes Classifier in Matlab 2008a

confMat=myconfusionmat(v,pv)
function confMat=myconfusionmat(v,pv)

yu=unique(v);
confMat=zeros(length(yu));
for i=1:length(yu)
    for j=1:length(yu)
        confMat(i,j)=sum(v==yu(i) & pv==yu(j));
    end
end

Contact us