The purpose of testing is to compare the outputs from the neural network against targets in an independent testing set. This will show the quality of the model before its deployment.

For function regression applications, calculation of the errors on the testing instances is usual. It is also frequent to calculate basic error statistics, and to draw error histograms. Despite of that, performing a linear regression analysis is the most standard method of testing a neural network for function regression.

This chapter is the last one that belongs to a set documents that explain how to use the main methods of OpenNN, so before continuing it is advisable to read the previous chapter ModelSelection class.

The easiest and the most common way to create a testing analysis object is with reference of the neural network and data set for the objects:

TestingAnalysis testing_analysis(&neural_network, &data_set);

For the classification problems, the most common testing method is the confusion matrix. It allows us to evaluate the accuracy of the model. It can be calculated with the following code.

Matrix<size_t> confusion_matrix = testing_analysis.calculate_confusion();

It is also possible to calculate the testing errors, which allows us to study the accuracy of the predictions of the model in comparison to the training and selection instances. The following method returns a vector with four positions, which contain: the sum squared error, the mean squared error, the root mean squared error and the normalized squared error.

Vector<double> confusion_matrix = testing_analysis.calculate_testing_errors();

If you need more information about TestingAnalysis class visit TestingAnalysis Class Reference