[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accuracy on a matrix
From: |
Jaroslav Hajek |
Subject: |
Re: accuracy on a matrix |
Date: |
Tue, 2 Jun 2009 20:45:20 +0200 |
On Tue, Jun 2, 2009 at 8:22 PM, Carlo Rossi <address@hidden> wrote:
>
> 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".
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz