CVB++ 14.0
ClassificationTestResult Class Reference

Classification test result object. More...

#include <cvb/polimago/classification_test_result.hpp>

Inherits TestResultBase.

Public Member Functions

 ClassificationTestResult (const String &fileName)
 Load a saved classification test result from a file. More...
 
 ClassificationTestResult (ClassificationTestResult &&) noexcept=default
 Move constructor.
 
ClassificationTestResultoperator= (ClassificationTestResult &&) noexcept=default
 Move assignment operator.
 
int NumClasses () const
 Number of classes in the sample database on which the test result was calculated. More...
 
int OutputDimension () const
 For tests with usage OneVersusAll the output dimension will equal the number of classes in the training database. For usage ClassifyOneVersusOne the output dimension is (NumClasses - 1) * (NumClasses) / 2. More...
 
int NumErrors () const
 Total number of errors made during classification testing. More...
 
double ErrorRate () const
 Total number of errors divided by the total number of examples. More...
 
std::vector< StringClasses () const
 Class labels available in this test result. More...
 
std::vector< double > ExampleConfidences () const
 Confidences in the classification decision for each sample. More...
 
std::vector< std::vector< double > > ExampleConfidenceDistributions () const
 Confidence distributions for each example. More...
 
std::vector< int > TrueClassIndices () const
 The real class index for each example. More...
 
std::vector< int > PredictedClassIndices () const
 Prediction results for all indices. More...
 
- Public Member Functions inherited from TestResultBase
int NumExamples () const
 Number of examples that contributed to this test result. More...
 
double TotalMeanSquareError () const
 Total mean square error of the predictor over all examples and all coordinates. More...
 
std::vector< double > ExampleMeanSquareError () const
 Mean square error for each individual example (the index runs over all the examples that contributed to this test result). More...
 
int FeatureResolution () const noexcept
 Feature resolution value with which the classifier was trained. More...
 
- Public Member Functions inherited from PolimagoFactoryCreatedObject
void * Handle () const noexcept
 Classic API Polimago handle. More...
 
String FileName () const
 Name of the file the object has been loaded from (or empty string if the object was not loaded). More...
 
void Save (const String &fileName) const
 Save this object into a file. More...
 
double Lambda () const noexcept
 Regularization value that has been used for generating this object. More...
 
double Offset () const noexcept
 Intercept weight that has been used for generating this object. More...
 
InterpolationType Interpolation () const noexcept
 Interpolation setting used for generating this object. More...
 
int ImagePlanes () const noexcept
 The plane count of the images that have been used for generating this classifier. Image on which this classifier is to be used will need to have the same plane count. More...
 
Rect< int > FeatureWindowExtent () const noexcept
 The feature window extent that has been used during classifier training. More...
 
Size2D< int > RetinaSize () const noexcept
 Size of the 'Retina' in pixels. The retina is the set of paxels onto which the input image is projected using the preprocessing code prior to application/training of the classifier. More...
 
Point2D< double > Correction () const noexcept
 Correction factors in X and Y direction required to rescale the input images for projection onto the retina. More...
 
String Preprocessing () const
 Preprocessing code with which this object was generated. More...
 

Static Public Member Functions

static std::unique_ptr< ClassificationTestResultFromHandle (ReleaseObjectGuard &&guard)
 Creates test result from a classic API handle. More...
 
static std::unique_ptr< ClassificationTestResultLoad (const String &fileName)
 Load a saved test result from a file. More...
 

Detailed Description

Classification test result object.

Constructor & Destructor Documentation

◆ ClassificationTestResult()

ClassificationTestResult ( const String fileName)
inline

Load a saved classification test result from a file.

Parameters
[in]fileNameName of the file to be loaded.
Returns
Loaded test result.
Exceptions
Anyexception derived from std::exception including CvbException.

Member Function Documentation

◆ Classes()

std::vector< String > Classes ( ) const
inline

Class labels available in this test result.

Returns
Class labels.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ErrorRate()

double ErrorRate ( ) const
inline

Total number of errors divided by the total number of examples.

Returns
The error rate.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ExampleConfidenceDistributions()

std::vector< std::vector< double > > ExampleConfidenceDistributions ( ) const
inline

Confidence distributions for each example.

Returns
Confidence distributions.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ExampleConfidences()

std::vector< double > ExampleConfidences ( ) const
inline

Confidences in the classification decision for each sample.

Returns
Example confidences.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ FromHandle()

static std::unique_ptr< ClassificationTestResult > FromHandle ( ReleaseObjectGuard &&  guard)
inlinestatic

Creates test result from a classic API handle.

Parameters
[in]guardLife time guard for C-API handle.
Returns
The test result created from the classic API handle.
Exceptions
Anyexception derived from std::exception including CvbException.

The predictor takes ownership of the handle, so you must share it before using this function.

◆ Load()

static std::unique_ptr< ClassificationTestResult > Load ( const String fileName)
inlinestatic

Load a saved test result from a file.

Parameters
[in]fileNameName of the file to be loaded.
Returns
Pointer to the loaded test result.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ NumClasses()

int NumClasses ( ) const
inline

Number of classes in the sample database on which the test result was calculated.

Returns
The class count.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ NumErrors()

int NumErrors ( ) const
inline

Total number of errors made during classification testing.

Returns
The error count.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ OutputDimension()

int OutputDimension ( ) const
inline

For tests with usage OneVersusAll the output dimension will equal the number of classes in the training database. For usage ClassifyOneVersusOne the output dimension is (NumClasses - 1) * (NumClasses) / 2.

Returns
The output dimension.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ PredictedClassIndices()

std::vector< int > PredictedClassIndices ( ) const
inline

Prediction results for all indices.

Returns
Predicted class indices.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ TrueClassIndices()

std::vector< int > TrueClassIndices ( ) const
inline

The real class index for each example.

Returns
True class indices.
Exceptions
Anyexception derived from std::exception including CvbException.