OTB  9.0.0
Orfeo Toolbox
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel > Class Template Reference

#include <otbConfusionMatrixMeasurements.h>

+ Inheritance diagram for otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >:
+ Collaboration diagram for otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >:

Public Types

typedef TLabel ClassLabelType
 
typedef TConfusionMatrix ConfusionMatrixType
 
typedef itk::SmartPointer< const SelfConstPointer
 
typedef std::map< ClassLabelType, int > MapOfClassesType
 
typedef std::map< int, ClassLabelTypeMapOfIndicesType
 
typedef itk::VariableLengthVector< double > MeasurementType
 
typedef itk::SmartPointer< SelfPointer
 
typedef ConfusionMatrixMeasurements Self
 
typedef itk::Object Superclass
 

Public Member Functions

void Compute (void)
 
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
virtual double GetFalseNegativeValue ()
 
virtual MeasurementType GetFalseNegativeValues ()
 
virtual double GetFalsePositiveValue ()
 
virtual MeasurementType GetFalsePositiveValues ()
 
virtual double GetFScore ()
 
virtual MeasurementType GetFScores ()
 
virtual double GetKappaIndex ()
 
MapOfClassesType GetMapOfClasses () const
 
MapOfIndicesType GetMapOfIndices () const
 
virtual const char * GetNameOfClass () const
 
virtual unsigned short GetNumberOfClasses ()
 
virtual unsigned long GetNumberOfSamples ()
 
virtual double GetOverallAccuracy ()
 
virtual double GetPrecision ()
 
virtual MeasurementType GetPrecisions ()
 
virtual double GetRecall ()
 
virtual MeasurementType GetRecalls ()
 
virtual double GetTrueNegativeValue ()
 
virtual MeasurementType GetTrueNegativeValues ()
 
virtual double GetTruePositiveValue ()
 
virtual MeasurementType GetTruePositiveValues ()
 
virtual void SetConfusionMatrix (ConfusionMatrixType _arg)
 
virtual void SetMapOfClasses (const MapOfClassesType &_arg)
 
virtual void SetMapOfIndices (const MapOfIndicesType &_arg)
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 ConfusionMatrixMeasurements ()
 
 ~ConfusionMatrixMeasurements () override
 

Private Member Functions

 ConfusionMatrixMeasurements (const Self &)=delete
 
void operator= (const Self &)=delete
 

Private Attributes

ConfusionMatrixType m_ConfusionMatrix
 
double m_FalseNegativeValue
 
MeasurementType m_FalseNegativeValues
 
double m_FalsePositiveValue
 
MeasurementType m_FalsePositiveValues
 
double m_FScore
 
MeasurementType m_FScores
 
double m_KappaIndex
 
MapOfClassesType m_MapOfClasses
 
MapOfIndicesType m_MapOfIndices
 
unsigned short m_NumberOfClasses
 
unsigned long m_NumberOfSamples
 
double m_OverallAccuracy
 
double m_Precision
 
MeasurementType m_Precisions
 
double m_Recall
 
MeasurementType m_Recalls
 
double m_TrueNegativeValue
 
MeasurementType m_TrueNegativeValues
 
double m_TruePositiveValue
 
MeasurementType m_TruePositiveValues
 

Detailed Description

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
class otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >

This class computes measurements on the input confusion matrix.

For a 2 classes problem, the confusion matrix is organized as follows:

\[ \left( \begin{array}{cc} True Positives & False Negatives \\ False Positives & True Negatives \end{array} \right) \]

Please note that when accessing the confusion matrix values, the first index is the row index (reference samples), and the second is the column index (produced samples).

Some measurements are computed by this class: If we consider true positive (TP), true negative (TN), false positive (FP) and false negative (FP) rates, then in the 2 classes case:

\[ precision = \frac{TP}{\left( TP + FP \right) } \]

\[ recall = \frac{TP}{\left( TP + FN \right) } \]

\[ FScore = \frac{2 * precision * recall}{\left( precision + recall \right) } \]

Moreover overall accuracy and

\[ \kappa \]

index are computed.

Definition at line 53 of file otbConfusionMatrixMeasurements.h.

Member Typedef Documentation

◆ ClassLabelType

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef TLabel otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::ClassLabelType

Definition at line 66 of file otbConfusionMatrixMeasurements.h.

◆ ConfusionMatrixType

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef TConfusionMatrix otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::ConfusionMatrixType

Type for the confusion matrix

Definition at line 73 of file otbConfusionMatrixMeasurements.h.

◆ ConstPointer

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef itk::SmartPointer<const Self> otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::ConstPointer

Definition at line 60 of file otbConfusionMatrixMeasurements.h.

◆ MapOfClassesType

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef std::map<ClassLabelType, int> otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::MapOfClassesType

Definition at line 69 of file otbConfusionMatrixMeasurements.h.

◆ MapOfIndicesType

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef std::map<int, ClassLabelType> otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::MapOfIndicesType

Definition at line 70 of file otbConfusionMatrixMeasurements.h.

◆ MeasurementType

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef itk::VariableLengthVector<double> otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::MeasurementType

Type for the measurement

Definition at line 76 of file otbConfusionMatrixMeasurements.h.

◆ Pointer

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef itk::SmartPointer<Self> otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::Pointer

Definition at line 59 of file otbConfusionMatrixMeasurements.h.

◆ Self

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef ConfusionMatrixMeasurements otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::Self

Standard class typedefs

Definition at line 57 of file otbConfusionMatrixMeasurements.h.

◆ Superclass

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
typedef itk::Object otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::Superclass

Definition at line 58 of file otbConfusionMatrixMeasurements.h.

Constructor & Destructor Documentation

◆ ConfusionMatrixMeasurements() [1/2]

template<class TConfusionMatrix , class TLabel >
otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::ConfusionMatrixMeasurements
protected

◆ ~ConfusionMatrixMeasurements()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::~ConfusionMatrixMeasurements ( )
inlineoverrideprotected

Definition at line 145 of file otbConfusionMatrixMeasurements.h.

◆ ConfusionMatrixMeasurements() [2/2]

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::ConfusionMatrixMeasurements ( const Self )
privatedelete

Member Function Documentation

◆ Compute()

template<class TConfusionMatrix , class TLabel >
void otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::Compute ( void  )

Computes the measurements over m_ConfusionMatrix.

Definition at line 46 of file otbConfusionMatrixMeasurements.hxx.

◆ CreateAnother()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual::itk::LightObject::Pointer otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::CreateAnother ( void  ) const

◆ GetFalseNegativeValue()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetFalseNegativeValue ( )
virtual

◆ GetFalseNegativeValues()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetFalseNegativeValues ( )
virtual

◆ GetFalsePositiveValue()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetFalsePositiveValue ( )
virtual

◆ GetFalsePositiveValues()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetFalsePositiveValues ( )
virtual

◆ GetFScore()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetFScore ( )
virtual

◆ GetFScores()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetFScores ( )
virtual

◆ GetKappaIndex()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetKappaIndex ( )
virtual

◆ GetMapOfClasses()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MapOfClassesType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetMapOfClasses ( ) const
inline

Definition at line 118 of file otbConfusionMatrixMeasurements.h.

◆ GetMapOfIndices()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MapOfIndicesType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetMapOfIndices ( ) const
inline

Definition at line 138 of file otbConfusionMatrixMeasurements.h.

◆ GetNameOfClass()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual const char* otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetNameOfClass ( ) const
virtual

Run-time type information (and related methods).

◆ GetNumberOfClasses()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual unsigned short otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetNumberOfClasses ( )
virtual

◆ GetNumberOfSamples()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual unsigned long otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetNumberOfSamples ( )
virtual

◆ GetOverallAccuracy()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetOverallAccuracy ( )
virtual

◆ GetPrecision()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetPrecision ( )
virtual

◆ GetPrecisions()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetPrecisions ( )
virtual

◆ GetRecall()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetRecall ( )
virtual

◆ GetRecalls()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetRecalls ( )
virtual

◆ GetTrueNegativeValue()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetTrueNegativeValue ( )
virtual

◆ GetTrueNegativeValues()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetTrueNegativeValues ( )
virtual

◆ GetTruePositiveValue()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetTruePositiveValue ( )
virtual

◆ GetTruePositiveValues()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::GetTruePositiveValues ( )
virtual

◆ New()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
static Pointer otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::New ( )
static

Method for creation through the object factory.

Referenced by otb::ConfusionMatrixCalculator< TRefListLabel, TProdListLabel >::ConfusionMatrixCalculator().

◆ operator=()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
void otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::operator= ( const Self )
privatedelete

◆ SetConfusionMatrix()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual void otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::SetConfusionMatrix ( ConfusionMatrixType  _arg)
virtual

Accessors

◆ SetMapOfClasses()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual void otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::SetMapOfClasses ( const MapOfClassesType _arg)
inlinevirtual

Definition at line 107 of file otbConfusionMatrixMeasurements.h.

◆ SetMapOfIndices()

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
virtual void otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::SetMapOfIndices ( const MapOfIndicesType _arg)
inlinevirtual

Definition at line 127 of file otbConfusionMatrixMeasurements.h.

Member Data Documentation

◆ m_ConfusionMatrix

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
ConfusionMatrixType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_ConfusionMatrix
private

◆ m_FalseNegativeValue

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_FalseNegativeValue
private

Definition at line 167 of file otbConfusionMatrixMeasurements.h.

◆ m_FalseNegativeValues

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_FalseNegativeValues
private

Definition at line 158 of file otbConfusionMatrixMeasurements.h.

◆ m_FalsePositiveValue

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_FalsePositiveValue
private

Definition at line 169 of file otbConfusionMatrixMeasurements.h.

◆ m_FalsePositiveValues

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_FalsePositiveValues
private

Definition at line 160 of file otbConfusionMatrixMeasurements.h.

◆ m_FScore

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_FScore
private

Definition at line 174 of file otbConfusionMatrixMeasurements.h.

◆ m_FScores

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_FScores
private

Definition at line 165 of file otbConfusionMatrixMeasurements.h.

◆ m_KappaIndex

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_KappaIndex
private

Definition at line 155 of file otbConfusionMatrixMeasurements.h.

◆ m_MapOfClasses

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MapOfClassesType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_MapOfClasses
private

Definition at line 176 of file otbConfusionMatrixMeasurements.h.

◆ m_MapOfIndices

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MapOfIndicesType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_MapOfIndices
private

Definition at line 177 of file otbConfusionMatrixMeasurements.h.

◆ m_NumberOfClasses

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
unsigned short otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_NumberOfClasses
private

◆ m_NumberOfSamples

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
unsigned long otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_NumberOfSamples
private

Definition at line 180 of file otbConfusionMatrixMeasurements.h.

◆ m_OverallAccuracy

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_OverallAccuracy
private

Definition at line 156 of file otbConfusionMatrixMeasurements.h.

◆ m_Precision

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_Precision
private

Definition at line 172 of file otbConfusionMatrixMeasurements.h.

◆ m_Precisions

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_Precisions
private

Definition at line 163 of file otbConfusionMatrixMeasurements.h.

◆ m_Recall

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_Recall
private

Definition at line 173 of file otbConfusionMatrixMeasurements.h.

◆ m_Recalls

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_Recalls
private

Definition at line 164 of file otbConfusionMatrixMeasurements.h.

◆ m_TrueNegativeValue

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_TrueNegativeValue
private

Definition at line 168 of file otbConfusionMatrixMeasurements.h.

◆ m_TrueNegativeValues

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_TrueNegativeValues
private

Definition at line 159 of file otbConfusionMatrixMeasurements.h.

◆ m_TruePositiveValue

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
double otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_TruePositiveValue
private

Definition at line 170 of file otbConfusionMatrixMeasurements.h.

◆ m_TruePositiveValues

template<class TConfusionMatrix = itk::VariableSizeMatrix<unsigned long>, class TLabel = int>
MeasurementType otb::ConfusionMatrixMeasurements< TConfusionMatrix, TLabel >::m_TruePositiveValues
private

Definition at line 161 of file otbConfusionMatrixMeasurements.h.


The documentation for this class was generated from the following files: