eVision C++ API 26.10.0-beta.2.dev
Loading...
Searching...
No Matches
eVision::EasyDeepLearning::EClassificationMetrics Class Reference

Collection of metrics used to evaluate the state of an EClassifier. More...

#include <eVision/EasyDeepLearning/EasyClassify/EClassificationMetrics.h>

Collaboration diagram for eVision::EasyDeepLearning::EClassificationMetrics:

Public Member Functions

 EClassificationMetrics ()
 Constructs an EClassificationMetrics object.
 EClassificationMetrics (const eVision::EasyDeepLearning::EClassificationMetrics &other)
 Copy constructor of an EClassificationMetrics object.
virtual ~EClassificationMetrics () throw ()
eVision::EasyDeepLearning::EClassificationMetrics & operator= (const eVision::EasyDeepLearning::EClassificationMetrics &other)
 Assignment operator.
void Load (const std::string &path)
 Loads a classification metric. The given ESerializer must have been created for reading.
void Load (eVision::ESerializer *serializer)
 Loads a classification metric. The given ESerializer must have been created for reading.
void Save (const std::string &path)
 Saves a classification metric. The given ESerializer must have been created for writing.
void Save (eVision::ESerializer *serializer)
 Saves a classification metric. The given ESerializer must have been created for writing.
bool IsValid () const
 Indicates whether the object contains at least one classification result.
void AddResult (const eVision::EasyDeepLearning::EClassificationResult &result, const std::string &groundtruthLabel)
 Adds the given result with the corresponding ground truth label to the metrics.
void AddMetrics (const eVision::EasyDeepLearning::EClassificationMetrics &other)
 Adds the other metrics to the current metrics of this object.
float GetAccuracy () const
 The accuracy of the classifier.
float GetWeightedAccuracy (const std::vector< float > &weights) const
 The label weighted accuracy.
float GetWeightedAccuracy (const eVision::EasyDeepLearning::EDataset &dataset) const
 The label weighted accuracy.
float GetBalancedAccuracy () const
 The balanced accuracy.
float GetLabelAccuracy (const std::string &label) const
 The accuracy of the classifier for a given label.
float GetError () const
 The error of the classifier.
float GetWeightedError (const std::vector< float > &weights) const
 The label weighted error.
float GetWeightedError (const eVision::EasyDeepLearning::EDataset &dataset) const
 The label weighted error.
float GetBalancedError () const
 The balanced error.
float GetLabelError (const std::string &label) const
 The error of the classifier for a given label.
bool CanComputeWeightedError () const
 Whether the object can be used to get weighted, balanced, and label errors.
uint32_t GetConfusion (const std::string &trueClass, const std::string &predictedClass) const
 Confusion value of one label with another.
 EClassificationMetrics (CppWrapperInternal::InternalConstructor)

Public Attributes

CppWrapperInternal::WrappedClass wrappedClass_

Detailed Description

Collection of metrics used to evaluate the state of an EClassifier.

A metric is a value summarizing a collection of classification results (EClassificationResult). New results can be added to the object individually with EClassificationMetrics::AddResult or collectively with EClassificationMetrics::AddMetrics.

EClassificationMetrics contains the following metrics:

License(s): BasicTypes

Constructor & Destructor Documentation

◆ EClassificationMetrics() [1/3]

eVision::EasyDeepLearning::EClassificationMetrics::EClassificationMetrics ( )

Constructs an EClassificationMetrics object.

◆ EClassificationMetrics() [2/3]

eVision::EasyDeepLearning::EClassificationMetrics::EClassificationMetrics ( const eVision::EasyDeepLearning::EClassificationMetrics & other)

Copy constructor of an EClassificationMetrics object.

Parameters
otherReference to the EClassificationMetrics object that should be copied

◆ ~EClassificationMetrics()

eVision::EasyDeepLearning::EClassificationMetrics::~EClassificationMetrics ( )
throw ( )
virtual

◆ EClassificationMetrics() [3/3]

eVision::EasyDeepLearning::EClassificationMetrics::EClassificationMetrics ( CppWrapperInternal::InternalConstructor )

Member Function Documentation

◆ AddMetrics()

void eVision::EasyDeepLearning::EClassificationMetrics::AddMetrics ( const eVision::EasyDeepLearning::EClassificationMetrics & other)

Adds the other metrics to the current metrics of this object.

Parameters
otherClassification metrics

◆ AddResult()

void eVision::EasyDeepLearning::EClassificationMetrics::AddResult ( const eVision::EasyDeepLearning::EClassificationResult & result,
const std::string & groundtruthLabel )

Adds the given result with the corresponding ground truth label to the metrics.

Parameters
resultA reference to an EClassificationResult object.
groundtruthLabelThe ground truth label corresponding to the result

◆ CanComputeWeightedError()

bool eVision::EasyDeepLearning::EClassificationMetrics::CanComputeWeightedError ( ) const

Whether the object can be used to get weighted, balanced, and label errors.

◆ GetAccuracy()

float eVision::EasyDeepLearning::EClassificationMetrics::GetAccuracy ( ) const

The accuracy of the classifier.

The accuracy is the number of images that were correctly classified (also called the true positives) over the total number of images that was used to evaluate the classifier.

◆ GetBalancedAccuracy()

float eVision::EasyDeepLearning::EClassificationMetrics::GetBalancedAccuracy ( ) const

The balanced accuracy.

The balanced accuracy is the label weighted accuracy with the same weight for each labels.

◆ GetBalancedError()

float eVision::EasyDeepLearning::EClassificationMetrics::GetBalancedError ( ) const

The balanced error.

The balanced error is the label weighted error with the same weight for each labels.

If EClassificationMetrics::CanComputeWeightedError is false, this method is an alias for EClassificationMetrics::GetError.

◆ GetConfusion()

uint32_t eVision::EasyDeepLearning::EClassificationMetrics::GetConfusion ( const std::string & trueClass,
const std::string & predictedClass ) const

Confusion value of one label with another.

The confusion value of a label with another is the number of images belonging to this label that are classified as belonging to the other label.

Parameters
trueClassThe label for which to obtain the confusion value
predictedClassThe label with which there is a confusion

◆ GetError()

float eVision::EasyDeepLearning::EClassificationMetrics::GetError ( ) const

The error of the classifier.

The error, which is also called the loss, is the quantity that is minimized during the training of the deep neural network. For classification, the error is the cross-entropy.

◆ GetLabelAccuracy()

float eVision::EasyDeepLearning::EClassificationMetrics::GetLabelAccuracy ( const std::string & label) const

The accuracy of the classifier for a given label.

Parameters
labelThe label of which we want the accuracy

The label accuracy is the number of images of a given label that were correctly classified (also called the true positives) over the total number of images of that label that was used to evaluate the classifier.

If there is no results for the given label, the method will throw an exception.

◆ GetLabelError()

float eVision::EasyDeepLearning::EClassificationMetrics::GetLabelError ( const std::string & label) const

The error of the classifier for a given label.

Parameters
labelThe label from which to get the error.

The label error corresponds to the error only for images of the given label.

If there is no results for the given label, the method will throw an exception. If EClassificationMetrics::CanComputeWeightedError is false, this method is an alias for EClassificationMetrics::GetError.

◆ GetWeightedAccuracy() [1/2]

float eVision::EasyDeepLearning::EClassificationMetrics::GetWeightedAccuracy ( const eVision::EasyDeepLearning::EDataset & dataset) const

The label weighted accuracy.

Parameters
datasetDataset from which to use the label weights

The weighted accuracy is the weighted average of the label accuracies (see EClassificationMetrics::GetLabelAccuracy). If there is no results for a given label, it will be ignored in the weighted accuracy.

◆ GetWeightedAccuracy() [2/2]

float eVision::EasyDeepLearning::EClassificationMetrics::GetWeightedAccuracy ( const std::vector< float > & weights) const

The label weighted accuracy.

Parameters
weightsArray of label weights for the labels of the classifier (see EDeepLearningTool::GetLabel)

The weighted accuracy is the weighted average of the label accuracies (see EClassificationMetrics::GetLabelAccuracy). If there is no results for a given label, it will be ignored in the weighted accuracy.

◆ GetWeightedError() [1/2]

float eVision::EasyDeepLearning::EClassificationMetrics::GetWeightedError ( const eVision::EasyDeepLearning::EDataset & dataset) const

The label weighted error.

Parameters
datasetDataset from which to use the label weights

The weighted error is the weighted average of the label errors (see EClassificationMetrics::GetLabelError).

If there isn't any result for a given label, it will be ignored in the weighted error.

If EClassificationMetrics::CanComputeWeightedError is false, this method is an alias for EClassificationMetrics::GetError.

◆ GetWeightedError() [2/2]

float eVision::EasyDeepLearning::EClassificationMetrics::GetWeightedError ( const std::vector< float > & weights) const

The label weighted error.

Parameters
weightsArray of label weights for the labels of the classifier (see EDeepLearningTool::GetLabel)

The weighted error is the weighted average of the label errors (see EClassificationMetrics::GetLabelError).

If there isn't any result for a given label, it will be ignored in the weighted error.

If EClassificationMetrics::CanComputeWeightedError is false, this method is an alias for EClassificationMetrics::GetError.

◆ IsValid()

bool eVision::EasyDeepLearning::EClassificationMetrics::IsValid ( ) const

Indicates whether the object contains at least one classification result.

◆ Load() [1/2]

void eVision::EasyDeepLearning::EClassificationMetrics::Load ( const std::string & path)

Loads a classification metric. The given ESerializer must have been created for reading.

Parameters
pathThe file path.

◆ Load() [2/2]

void eVision::EasyDeepLearning::EClassificationMetrics::Load ( eVision::ESerializer * serializer)

Loads a classification metric. The given ESerializer must have been created for reading.

Parameters
serializerThe serializer.

◆ operator=()

eVision::EasyDeepLearning::EClassificationMetrics & eVision::EasyDeepLearning::EClassificationMetrics::operator= ( const eVision::EasyDeepLearning::EClassificationMetrics & other)

Assignment operator.

Parameters
otherReference to the EClassificationMetrics object used for the assignment

◆ Save() [1/2]

void eVision::EasyDeepLearning::EClassificationMetrics::Save ( const std::string & path)

Saves a classification metric. The given ESerializer must have been created for writing.

Parameters
pathThe file path.

◆ Save() [2/2]

void eVision::EasyDeepLearning::EClassificationMetrics::Save ( eVision::ESerializer * serializer)

Saves a classification metric. The given ESerializer must have been created for writing.

Parameters
serializerThe ESerializer object that is written to.

Member Data Documentation

◆ wrappedClass_

CppWrapperInternal::WrappedClass eVision::EasyDeepLearning::EClassificationMetrics::wrappedClass_