[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accuracy on a matrix
From: |
Carlo Rossi |
Subject: |
Re: accuracy on a matrix |
Date: |
Tue, 2 Jun 2009 18:22:41 +0000 (GMT) |
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,
--- Mar 2/6/09, Jaroslav Hajek <address@hidden> ha scritto:
> Da: Jaroslav Hajek <address@hidden>
> Oggetto: Re: accuracy on a matrix
> A: "Carlo Rossi" <address@hidden>
> Cc: address@hidden
> Data: Martedì 2 giugno 2009, 07:14
> On Tue, Jun 2, 2009 at 2:40 AM, Carlo
> Rossi <address@hidden>
> wrote:
> > Hello,
> > I have a problem that is not strictly on Octave but
> maybe it can be
> > interesting as I didn't find solution anywhere.
> > I have a matrix where each column/rows represent a
> class; I'm speaking about
> > a confusion matrix.
> > for example, three classes conf. matrix
> > A = [2 1 1; 0 3 1; 0 0 4];
> >
> > and I read this: http://en.wikipedia.org/wiki/Accuracy_and_precision
> > Is there any chance to use the first formula of
> accuracy (actually with more
> > than 2 classes I don't understand how apply it)
> without use the
> > Prevalence,Sensitivity etc?
> >
> > thanks,
> >
>
> It's obvious, isn't it?
> accuracy = trace(A) / sum(A(:));
> Diagonal elements represent correct classifications, the
> rest are
> misclassifications.
>
> cheers
>
> --
> RNDr. Jaroslav Hajek
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
>