Polimago (Polimago.dll) 15.0
Testing

Functions

cvbbool_t PMGetTestResultClassLabel (TTESTRESULT testResult, cvbval_t classIndex, char *szClassLabel)
 Get the class label corresponding to a given index and test result. More...
 
cvbbool_t PMGetTestResultClassLabelW (TTESTRESULT testResult, cvbval_t classIndex, wchar_t *szClassLabel)
 Get the class label corresponding to a given index and test result. More...
 
double PMGetTestResultConfidence (TTESTRESULT testResult, cvbval_t exampleIndex)
 Returns the confidence associated with the classification of a specified example. More...
 
double PMGetTestResultConfidenceDistribution (TTESTRESULT testResult, cvbval_t exampleIndex, cvbval_t classIndex)
 Returns the confidence asserted by the classifier for a classification of a specified example to a specified class. More...
 
double PMGetTestResultErrorRate (TTESTRESULT testResult)
 Returns the error rate (total number of errors divided by total number of examples) made during classification testing. More...
 
double PMGetTestResultExampleMeanSquareError (TTESTRESULT testResult, cvbval_t ExampleIndex)
 Returns the mean square error on a test example over all output coordinates. More...
 
cvbval_t PMGetTestResultNumClasses (TTESTRESULT testResult)
 Returns the number of classes for a classifier used in the test. More...
 
double PMGetTestResultNumericalPrediction (TTESTRESULT testResult, cvbval_t exampleIndex, cvbval_t coordinateIndex)
 Returns the actual value predicted for a specified example and a specified output coordinate. More...
 
cvbval_t PMGetTestResultNumErrors (TTESTRESULT testResult)
 Returns the total number of errors made during classification testing. More...
 
cvbval_t PMGetTestResultNumExamples (TTESTRESULT testResult)
 Retrieves the number of examples that were tested. More...
 
cvbval_t PMGetTestResultOutputDimension (TTESTRESULT testResult)
 Get the number of numerical values estimated for a given test result. More...
 
cvbval_t PMGetTestResultPredictedClass (TTESTRESULT testResult, cvbval_t exampleIndex)
 Returns the class index which was predicted for a specific example. More...
 
double PMGetTestResultTargetValue (TTESTRESULT testResult, cvbval_t exampleIndex, cvbval_t coordinateIndex)
 Returns the target value to be predicted for a specified example and a specified output coordinate. More...
 
double PMGetTestResultTotalMeanSquareError (TTESTRESULT testResult)
 Returns the mean square error of the predictor over all examples and all coordinates. More...
 
void PMGetTestResultTrainParams (TTESTRESULT testResult, TTrainParams &params)
 Retrieves the training parameters that were used for generating a test result. More...
 
cvbval_t PMGetTestResultTrueClassIndex (TTESTRESULT testResult, cvbval_t exampleIndex)
 Returns the index of the true class to which an example belongs. More...
 
TPolimagoTrainingError PMLeaveOutTestGeneric (TLEARNINGDATAACCESS db, TProgress *Progress, cvbval_t HoldOutSize, TClassifierUsage usage, const char *szPreproCode, cvbval_t featureResolution, double lambda, cvbbool_t interpolate, TTESTRESULT &TestResult)
 Performs a leave-out-crossvalidation on the specified training data set. More...
 
TPolimagoTrainingError PMLeaveOutTestOnMts (MTS mts, TProgress *Progress, cvbval_t HoldOutSize, TClassifierUsage usage, const char *szPreproCode, cvbval_t featureResolution, double lambda, cvbbool_t interpolate, TTESTRESULT &TestResult)
 Performs a leave-out-crossvalidation on the specified training data set. More...
 
TPolimagoTrainingError PMLeaveOutTestOnSil (TSIL sil, TProgress *Progress, cvbval_t HoldOutSize, TClassifierUsage usage, const char *szPreproCode, cvbval_t featureResolution, double lambda, cvbbool_t interpolate, TTESTRESULT &TestResult)
 Performs a leave-out-crossvalidation on the specified training data set. More...
 
cvbbool_t PMOpenTestResult (const char *szFileName, TTESTRESULT &testResult)
 Loads the result of a sample test or a leave out test from a file. More...
 
cvbbool_t PMOpenTestResultW (const wchar_t *szFileName, TTESTRESULT &testResult)
 Loads the result of a sample test or a leave out test from a file. More...
 
TPolimagoTrainingError PMSampleTestGeneric (TLEARNINGDATAACCESS db, TProgress *Progress, TCLF Clf, TTESTRESULT &TestResult)
 Test a given classifier on test data available as generic data access. More...
 
TPolimagoTrainingError PMSampleTestOnMts (MTS mts, TProgress *Progress, TCLF Clf, TTESTRESULT &TestResult)
 Test a given classifier on test data available as a MTS (Minos Training Set). More...
 
TPolimagoTrainingError PMSampleTestOnSil (TSIL sil, TProgress *Progress, TCLF Clf, TTESTRESULT &TestResult)
 Test a given classifier on test data available as a SIL (Sample Image List). More...
 
cvbbool_t PMSaveTestResult (const char *szFileName, TTESTRESULT testResult)
 Save the result of a sample test or a leave out test to a file. More...
 
cvbbool_t PMSaveTestResultW (const wchar_t *szFileName, TTESTRESULT testResult)
 Save the result of a sample test or a leave out test to a file. More...
 

Detailed Description

Function Documentation

◆ PMGetTestResultClassLabel()

cvbbool_t PMGetTestResultClassLabel ( TTESTRESULT  testResult,
cvbval_t  classIndex,
char *  szClassLabel 
)

Get the class label corresponding to a given index and test result.

Attention
The buffer pointed to by szClassLabel must be big enough to hold the entire class label, otherwise a write access violation may occur. To be on the safe side, alway allocate at least 256 bytes.
Parameters
[in]testResultHandle of the test result container.
[in]classIndexIndex of the class in question. Must be nonnegative and smaller than the return value of PMGetTestResultNumClasses.
[in]szClassLabelPointer to a buffer that will receive the class label string (zero-terminated!.
Returns
TRUE if the call was successful (i.e. all parameters are valid) FALSE otherwise.

◆ PMGetTestResultClassLabelW()

cvbbool_t PMGetTestResultClassLabelW ( TTESTRESULT  testResult,
cvbval_t  classIndex,
wchar_t *  szClassLabel 
)

Get the class label corresponding to a given index and test result.

Attention
The buffer pointed to by szClassLabel must be big enough to hold the entire class label, otherwise a write access violation may occur. To be on the safe side, alway allocate at least 256 bytes.
Parameters
[in]testResultHandle of the test result container.
[in]classIndexIndex of the class in question. Must be nonnegative and smaller than the return value of PMGetTestResultNumClasses.
[in]szClassLabelPointer to a buffer that will receive the class label string (zero-terminated!.
Returns
TRUE if the call was successful (i.e. all parameters are valid) FALSE otherwise.

◆ PMGetTestResultConfidence()

double PMGetTestResultConfidence ( TTESTRESULT  testResult,
cvbval_t  exampleIndex 
)

Returns the confidence associated with the classification of a specified example.

Parameters
[in]testResultHandle of the test result container.
[in]exampleIndexIndex of example.
Returns
Confidence in classification for the example.

◆ PMGetTestResultConfidenceDistribution()

double PMGetTestResultConfidenceDistribution ( TTESTRESULT  testResult,
cvbval_t  exampleIndex,
cvbval_t  classIndex 
)

Returns the confidence asserted by the classifier for a classification of a specified example to a specified class.

Parameters
[in]testResultHandle of the test result container.
[in]exampleIndexIndex of example.
[in]classIndexIndex of class.
Returns
Relative confidence.

◆ PMGetTestResultErrorRate()

double PMGetTestResultErrorRate ( TTESTRESULT  testResult)

Returns the error rate (total number of errors divided by total number of examples) made during classification testing.

Parameters
[in]testResultHandle of the test result container.
Returns
Error rate of the test result.

◆ PMGetTestResultExampleMeanSquareError()

double PMGetTestResultExampleMeanSquareError ( TTESTRESULT  testResult,
cvbval_t  ExampleIndex 
)

Returns the mean square error on a test example over all output coordinates.

Parameters
[in]testResultHandle of the test result container.
[in]ExampleIndexIndex of an example in the test result.
Returns
Mean square error for the queried example.

◆ PMGetTestResultNumClasses()

cvbval_t PMGetTestResultNumClasses ( TTESTRESULT  testResult)

Returns the number of classes for a classifier used in the test.

For tests calculated with usage = CU_Regression the return value will be zero.

Parameters
[in]testResultHandle of the test result container.
Returns
Number of classes involved in the test.

◆ PMGetTestResultNumericalPrediction()

double PMGetTestResultNumericalPrediction ( TTESTRESULT  testResult,
cvbval_t  exampleIndex,
cvbval_t  coordinateIndex 
)

Returns the actual value predicted for a specified example and a specified output coordinate.

Parameters
[in]testResultHandle of the test result container.
[in]exampleIndexIndex of test example.
[in]coordinateIndexCoordinate index of predictor output. Must be larger or equal to zero and less than the result of PMGetTestResultOutputDimension.
Returns
Predicted sample value (compare to output of PMGetTestResultTargetValue to verify correctness).

◆ PMGetTestResultNumErrors()

cvbval_t PMGetTestResultNumErrors ( TTESTRESULT  testResult)

Returns the total number of errors made during classification testing.

Parameters
[in]testResultHandle of the test result container.
Returns
Number of errors in the test result.

◆ PMGetTestResultNumExamples()

cvbval_t PMGetTestResultNumExamples ( TTESTRESULT  testResult)

Retrieves the number of examples that were tested.

Parameters
[in]testResultHandle of the test result container.
Returns
The number of examples.

◆ PMGetTestResultOutputDimension()

cvbval_t PMGetTestResultOutputDimension ( TTESTRESULT  testResult)

Get the number of numerical values estimated for a given test result.

For tests based on numerical regression (usage = CU_Regression) the result will match the label dimension used in the training database. For tests with usage = CU_ClassifyOneVersusAll the output dimension will equal the number of classes in the training database. For usage = CU_ClassifyOneVersusOne the output dimension is

(numclasses-1) * numclasses / 2

.

Parameters
[in]testResultHandle of the test result container.
Returns
The number of numerical values estimated in each step.

◆ PMGetTestResultPredictedClass()

cvbval_t PMGetTestResultPredictedClass ( TTESTRESULT  testResult,
cvbval_t  exampleIndex 
)

Returns the class index which was predicted for a specific example.

Parameters
[in]testResultHandle of the test result container.
[in]exampleIndexIndex of example.
Returns
Predicted class index of the example.

◆ PMGetTestResultTargetValue()

double PMGetTestResultTargetValue ( TTESTRESULT  testResult,
cvbval_t  exampleIndex,
cvbval_t  coordinateIndex 
)

Returns the target value to be predicted for a specified example and a specified output coordinate.

Parameters
[in]testResultHandle of the test result container.
[in]exampleIndexIndex of test example.
[in]coordinateIndexCoordinate index of predictor output. Must be larger or equal to zero and less than the result of PMGetTestResultOutputDimension.
Returns
Theoretically correct result of the prediction.

◆ PMGetTestResultTotalMeanSquareError()

double PMGetTestResultTotalMeanSquareError ( TTESTRESULT  testResult)

Returns the mean square error of the predictor over all examples and all coordinates.

Parameters
[in]testResultHandle of the test result container.
Returns
The total mean square error.

◆ PMGetTestResultTrainParams()

void PMGetTestResultTrainParams ( TTESTRESULT  testResult,
TTrainParams params 
)

Retrieves the training parameters that were used for generating a test result.

Parameters
[in]testResultHandle of the test result container.
[out]paramsThe training parameters used during generation of the test result.

◆ PMGetTestResultTrueClassIndex()

cvbval_t PMGetTestResultTrueClassIndex ( TTESTRESULT  testResult,
cvbval_t  exampleIndex 
)

Returns the index of the true class to which an example belongs.

Parameters
[in]testResultHandle of the test result container.
[in]exampleIndexIndex of example.
Returns
True class index of the example.

◆ PMLeaveOutTestGeneric()

TPolimagoTrainingError PMLeaveOutTestGeneric ( TLEARNINGDATAACCESS  db,
TProgress Progress,
cvbval_t  HoldOutSize,
TClassifierUsage  usage,
const char *  szPreproCode,
cvbval_t  featureResolution,
double  lambda,
cvbbool_t  interpolate,
TTESTRESULT TestResult 
)

Performs a leave-out-crossvalidation on the specified training data set.

In a leave-out-crossvalidation a number of training examples (holdout set) is removed from the data training set each on each step and is used for testing with a classifier that is generated from the rest of the training samples. The process is repeated until every example in the whole data set has been tested once.

Parameters
[in]dbHandle of the training data set as returned by PMCreateLearningDataAccess. Note that the set of callbacks specified in the call to PMCreateLearningDataAccess must match the value of the usage mode parameter!
[in]ProgressCallback structure for progress report. May be used to show testing progress on the user interface (see description of TProgress).
[in]HoldOutSizeNumber of examples to leave out on each pass.
[in]usageClassifier usage (see description of TClassifierUsage).
[in]szPreproCodePreprocessing code to be used for the training steps of the test.
[in]featureResolutionDetermines the dimensions of the classifier's retina (see feature-map lesson in the tutorial on search functions)
[in]lambdaRidge regression regularization constant. The default value 0.01 works well in most cases. May be slightly increased for very small numbers of training examples and slightly decreased for very large numbers of training examples.
[in]interpolateImage interpolation mode for feature extraction. implies simple truncation of fractional coordinates, TRUE (recommended) implies bilinear interpolation.
[out]TestResultReceives the handle to the test result container (see description of TTESTRESULT).
Returns
One of the return codes defined in TPolimagoTrainingError.

◆ PMLeaveOutTestOnMts()

TPolimagoTrainingError PMLeaveOutTestOnMts ( MTS  mts,
TProgress Progress,
cvbval_t  HoldOutSize,
TClassifierUsage  usage,
const char *  szPreproCode,
cvbval_t  featureResolution,
double  lambda,
cvbbool_t  interpolate,
TTESTRESULT TestResult 
)

Performs a leave-out-crossvalidation on the specified training data set.

In a leave-out-crossvalidation a number of training examples (holdout set) is removed from the data training set each on each step and is used for testing with a classifier that is generated from the rest of the training samples. The process is repeated until every example in the whole data set has been tested once.

Parameters
[in]mtsSpecifies the training data set.
[in]ProgressCallback structure for progress report. May be used to show testing progress on the user interface (see description of TProgress).
[in]HoldOutSizeNumber of examples to leave out on each pass.
[in]usageClassifier usage (see description of TClassifierUsage).
[in]szPreproCodePreprocessing code to be used for the training steps of the test.
[in]featureResolutionDetermines the dimensions of the classifier's retina (see feature-map lesson in the tutorial on search functions)
[in]lambdaRidge regression regularization constant. The default value 0.01 works well in most cases. May be slightly increased for very small numbers of training examples and slightly decreased for very large numbers of training examples.
[in]interpolateImage interpolation mode for feature extraction. implies simple truncation of fractional coordinates, TRUE (recommended) implies bilinear interpolation.
[out]TestResultReceives the handle to the test result container (see description of TTESTRESULT).
Returns
One of the return codes defined in TPolimagoTrainingError.

◆ PMLeaveOutTestOnSil()

TPolimagoTrainingError PMLeaveOutTestOnSil ( TSIL  sil,
TProgress Progress,
cvbval_t  HoldOutSize,
TClassifierUsage  usage,
const char *  szPreproCode,
cvbval_t  featureResolution,
double  lambda,
cvbbool_t  interpolate,
TTESTRESULT TestResult 
)

Performs a leave-out-crossvalidation on the specified training data set.

In a leave-out-crossvalidation a number of training examples (holdout set) is removed from the data training set each on each step and is used for testing with a classifier that is generated from the rest of the training samples. The process is repeated until every example in the whole data set has been tested once.

Parameters
[in]silSpecifies the training data set.
[in]ProgressCallback structure for progress report. May be used to show testing progress on the user interface (see description of TProgress).
[in]HoldOutSizeNumber of examples to leave out on each pass.
[in]usageClassifier usage (see description of TClassifierUsage).
[in]szPreproCodePreprocessing code to be used for the training steps of the test.
[in]featureResolutionDetermines the dimensions of the classifier's retina (see feature-map lesson in the tutorial on search functions)
[in]lambdaRidge regression regularization constant. The default value 0.01 works well in most cases. May be slightly increased for very small numbers of training examples and slightly decreased for very large numbers of training examples.
[in]interpolateImage interpolation mode for feature extraction. implies simple truncation of fractional coordinates, TRUE (recommended) implies bilinear interpolation.
[out]TestResultReceives the handle to the test result container (see description of TTESTRESULT).
Returns
One of the return codes defined in TPolimagoTrainingError.

◆ PMOpenTestResult()

cvbbool_t PMOpenTestResult ( const char *  szFileName,
TTESTRESULT testResult 
)

Loads the result of a sample test or a leave out test from a file.

If the test result can be successfully loaded from the given path its reference count will be initialized to 1 and a ReleaseObject call (see CVCImg.dll reference) will be needed to release the memory occupied by the classifier.

Parameters
[in]szFileNamePointer to a zero-terminated string containing the name of the file to be loaded.
[out]testResultReceives the test result handle if the test result was loaded successfully.
Returns
TRUE if loading the test result from the specified path was successful, FALSE if not

◆ PMOpenTestResultW()

cvbbool_t PMOpenTestResultW ( const wchar_t *  szFileName,
TTESTRESULT testResult 
)

Loads the result of a sample test or a leave out test from a file.

If the test result can be successfully loaded from the given path its reference count will be initialized to 1 and a ReleaseObject call (see CVCImg.dll reference) will be needed to release the memory occupied by the classifier.

Parameters
[in]szFileNamePointer to a zero-terminated string containing the name of the file to be loaded.
[out]testResultReceives the test result handle if the test result was loaded successfully.
Returns
TRUE if loading the test result from the specified path was successful, FALSE if not

◆ PMSampleTestGeneric()

TPolimagoTrainingError PMSampleTestGeneric ( TLEARNINGDATAACCESS  db,
TProgress Progress,
TCLF  Clf,
TTESTRESULT TestResult 
)

Test a given classifier on test data available as generic data access.

Performs a sample test of a classifier on a set of learning data, i.e. every single example inside the learning set is classified using the classifier Clf and the result is compared versus the sample's true label.

Parameters
[in]dbHandle of the training data set as returned by PMCreateLearningDataAccess. Note that the set of callbacks specified in the call to PMCreateLearningDataAccess must match the classifier's usage mode!
[in]ProgressCallback structure for progress report. Can be used to show training progress on the user interface (see description of the TProgress struct).
[in]ClfHandle of the classifier to be used for testing.
[out]TestResultReceives the handle of the aggregated test result (see description of TTESTRESULT).
Returns
One of the return codes defined in TPolimagoTrainingError.

◆ PMSampleTestOnMts()

TPolimagoTrainingError PMSampleTestOnMts ( MTS  mts,
TProgress Progress,
TCLF  Clf,
TTESTRESULT TestResult 
)

Test a given classifier on test data available as a MTS (Minos Training Set).

Performs a sample test of a classifier on a minos training set, i.e. every single sample inside the training set is classified using the classifier Clf and the result is compared versus the sample's true label.

Parameters
[in]mtsHandle of the training data set.
[in]ProgressCallback structure for progress report. Can be used to show training progress on the user interface (see description of the TProgress struct).
[in]ClfHandle of the classifier to be used for testing.
[out]TestResultReceives the handle of the aggregated test result (see description of TTESTRESULT).
Returns
One of the return codes defined in TPolimagoTrainingError.

◆ PMSampleTestOnSil()

TPolimagoTrainingError PMSampleTestOnSil ( TSIL  sil,
TProgress Progress,
TCLF  Clf,
TTESTRESULT TestResult 
)

Test a given classifier on test data available as a SIL (Sample Image List).

Performs a sample test of a classifier on a sample image list, i.e. every single sample inside the sample image list is classified using the classifier Clf and the result is compared versus the sample's true label.

Parameters
[in]silHandle of the training data set.
[in]ProgressCallback structure for progress report. Can be used to show training progress on the user interface (see description of the TProgress struct).
[in]ClfHandle of the classifier to be used for testing.
[out]TestResultReceives the handle of the aggregated test result (see description of TTESTRESULT).
Returns
One of the return codes defined in TPolimagoTrainingError.

◆ PMSaveTestResult()

cvbbool_t PMSaveTestResult ( const char *  szFileName,
TTESTRESULT  testResult 
)

Save the result of a sample test or a leave out test to a file.

Parameters
[in]szFileNamePointer to the zero-terminated string containing the file name to save the test result to. Note that existing files will be overwritten.
[in]testResultHandle of the test result.
Returns
TRUE if saving the classifier to the specified path was successful, FALSE if not

◆ PMSaveTestResultW()

cvbbool_t PMSaveTestResultW ( const wchar_t *  szFileName,
TTESTRESULT  testResult 
)

Save the result of a sample test or a leave out test to a file.

Parameters
[in]szFileNamePointer to the zero-terminated string containing the file name to save the test result to. Note that existing files will be overwritten.
[in]testResultHandle of the test result.
Returns
TRUE if saving the classifier to the specified path was successful, FALSE if not