[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 19:49:05 +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,
> >
>
> 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