accuracy on a matrix

Carlo Rossi serosole at yahoo.it
Tue Jun 2 14:49:05 CDT 2009


> > Hello,
> > it isn't  obvious because implementing it (but with
> Matlab in this two way:
> >
> > classification = knnclassify(TEST, TRAIN, GROUP, 1);
> > [C, order] = confusionmat(TARGET, classification);
> > cp = classperf(TARGET, Kclassification);
> > acc1 =
> (cp.Sensitivity*cp.Prevalence)cp.Specificity*(1-cp.Prevalence)
> > acc2 = sum(diag( C )) / sum( C(:) )
> >
> > According to here I should return the same accuracy:
> > http://en.wikipedia.org/wiki/Accuracy_and_precision
> >
> > But they are diffent! So for this reason I asked If
>  I were using the right formula. Does anyone have
> experience with this stuff?
> > I need to understand why the are different
> > thanks,
> >
> 
> The acc1 formula above is only valid for binary
> classification and
> requires splitting the class labels into positive and
> negative. See
> the documentation of classperf, "PositiveValue" and
> "NegativeValue".

sorry you finished into my antispam! Then, only acc1 formula is right for only binary or even the acc2. Actually I need one that can work on multiple classes...
thanksm


      




More information about the Help-octave mailing list