Skip to content

Test a model

lamipaul edited this page Jul 25, 2018 · 5 revisions

The test-model function helps measuring a model's performance at the recognition task, given a dataset. To do so, for each sample given in input, it compares the actual class and predicted class. Counting the errors and the successes, an accuracy is output.

Inputs

Plug the trained xmm-model object's self output into the model input of the test-model function. The Dataset input expects the exact same format as the dataset input of the xmm object : a list of labelled samples. The dataset used for training can be used for testing by plugging in the dataset output of the xmm-model object.

Outputs

The accuracy measure (between 0 and 1) is output by the function when evaluated. 1 means the model has successfully classified every sample, 0 means it didn't predict the right class of any sample.

Displaying testing results

To better understand the model's behaviour, the xmm-model object stores the errors and successes encountered throughout testing. The user can access these informations with two distinct functions, after the test-model function has been evaluated. For both of them, plug the tested xmm-model object's self output into the self input.

Use get-errors and get-confusion-matrix to display your tests' detailled results

Get-errors

Get-errors prints in the console the number of errors for each label to predict.

Get-confusion-matrix

The get-confusion-matrix function outputs a 2d-array object containing the confusion matrix of the test. Plug its output to the self input of a 2d-array object to display the matrix.

The rows correspond to the actual classes, and the column the predicted classes. Thus, 0.17 at "A"x"B" indicates that 17% of the samples of the "A" class were classified as "B". The numbers on the right column of the matrix indicate the total number of samples for each class.

Clone this wiki locally