Skip to content
Snippets Groups Projects
Commit 053ff946 authored by Jordi Inglada's avatar Jordi Inglada
Browse files

ENH: Computation od OverallAccuracy and KappaIndex

parent 99afedee
Branches
Tags
No related merge requests found
......@@ -112,11 +112,6 @@ ConfusionMatrixCalculator<TRefListLabel,TProdListLabel>
}
otbGenericMsgDebugMacro(<<"Confusion matrix " << m_ConfusionMatrix);
for(unsigned int i=0; i<m_NumberOfClasses; i++)
otbGenericMsgDebugMacro(<<"Samples per class " << samplesPerClass[i]);
this->m_OverallAccuracy = 0.;
for (unsigned int i = 0;i<m_NumberOfClasses;++i)
{
......@@ -125,9 +120,6 @@ ConfusionMatrixCalculator<TRefListLabel,TProdListLabel>
this->m_OverallAccuracy/=static_cast<double>(m_NumberOfSamples);
otbGenericMsgDebugMacro(<<"OA " << this->m_OverallAccuracy);
double luckyRate = 0.;
for (unsigned int i = 0;i<m_NumberOfClasses;++i)
{
......@@ -144,9 +136,8 @@ ConfusionMatrixCalculator<TRefListLabel,TProdListLabel>
luckyRate/=vcl_pow(m_NumberOfSamples,2.0);
double m_KappaIndex = (m_OverallAccuracy-luckyRate)/(1-luckyRate);
m_KappaIndex = (m_OverallAccuracy-luckyRate)/(1-luckyRate);
}
......
......@@ -205,18 +205,19 @@ int otbConfusionMatrixCalculatorUpdate(int argc, char* argv[])
return EXIT_FAILURE;
}
if( calculator->GetOverallAccuracy() != 1.0 )
if( calculator->GetKappaIndex() != 1.0 )
{
std::cerr<< "OA = " << calculator->GetOverallAccuracy() << std::endl;
std::cerr<< "Kappa = " << calculator->GetKappaIndex() << std::endl;
return EXIT_FAILURE;
}
if( calculator->GetKappaIndex() != 1.0 )
if( calculator->GetOverallAccuracy() != 1.0 )
{
std::cerr<< "OA = " << calculator->GetKappaIndex() << std::endl;
std::cerr<< "OA = " << calculator->GetOverallAccuracy() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment