OpenNN
2.2
Open Neural Networks Library
|
#include <testing_analysis.h>
Classes | |
struct | LinearRegressionResults |
Private Attributes | |
NeuralNetwork * | neural_network_pointer |
DataSet * | data_set_pointer |
MathematicalModel * | mathematical_model_pointer |
bool | display |
This class contains tools for testing neural networks in different learning tasks. In particular, it can be used for testing function regression, pattern recognition or time series prediction problems.
Definition at line 42 of file testing_analysis.h.
|
explicit |
Default constructor. It creates a testing analysis object neither associated to a neural network nor to a mathematical model or a data set. By default, it constructs the function regression testing object.
Definition at line 27 of file testing_analysis.cpp.
|
explicit |
Neural network constructor. It creates a testing analysis object associated to a neural network but not to a mathematical model or a data set. By default, it constructs the function regression testing object.
new_neural_network_pointer | Pointer to a neural network object. |
Definition at line 43 of file testing_analysis.cpp.
|
explicit |
Mathematical mmodel constructor. It creates a testing analysis object not associated to a neural network, not associated to a data set, and associated to a mathematical model. By default, it constructs the inverse problem testing object.
new_mathematical_model_pointer | Pointer to a mathematical model object. |
Definition at line 59 of file testing_analysis.cpp.
|
explicit |
Data set constructor. It creates a testing analysis object not associated to a neural network, associated to a data set and not associated to a mathematical model. By default, it constructs the function regression testing object.
new_data_set_pointer | Pointer to a data set object. |
Definition at line 75 of file testing_analysis.cpp.
|
explicit |
Neural network and data set constructor. It creates a testing analysis object associated to a neural network and to a data set. By default, it constructs the function regression testing object.
new_neural_network_pointer | Pointer to a neural network object. |
new_data_set_pointer | Pointer to a data set object. |
Definition at line 109 of file testing_analysis.cpp.
|
explicit |
Neural network and mathematical model constructor. It creates a testing analysis object associated to a neural network and to a mathematical model, but not to a data set. By default, it constructs the inverse problem testing object.
new_neural_network_pointer | Pointer to a neural network object. |
new_mathematical_model_pointer | Pointer to a mathematical model object. |
Definition at line 92 of file testing_analysis.cpp.
|
explicit |
Neural network, mathematical model and data set constructor. It creates a testing analysis object associated to a neural network, a mathematical model and a data set. By default, it constructs the inverse problem testing object.
new_neural_network_pointer | Pointer to a neural network object. |
new_mathematical_model_pointer | Pointer to a mathematical model object. |
new_data_set_pointer | Pointer to a data set object. |
Definition at line 127 of file testing_analysis.cpp.
|
explicit |
XML constructor. It creates a testing analysis object neither associated to a neural network nor to a mathematical model or a data set. It also loads the members of this object from a TinyXML document.
testing_analysis_document | XML document containing the member data. |
Definition at line 143 of file testing_analysis.cpp.
|
explicit |
File constructor. It creates a testing analysis object neither associated to a neural network nor to a mathematical model or a data set. It also loads the members of this object from XML file.
file_name | Name of testing analysis XML file. |
Definition at line 161 of file testing_analysis.cpp.
|
virtual |
Destructor. It deletes the function regression testing, pattern recognition testing, time series prediction testing and inverse problem testing objects.
Definition at line 176 of file testing_analysis.cpp.
Vector< double > OpenNN::TestingAnalysis::calculate_binary_classification_tests | ( | void | ) | const |
Returns the results of a binary classification test in a single vector. The size of that vector is six. The elements are:
Definition at line 923 of file testing_analysis.cpp.
Matrix< size_t > OpenNN::TestingAnalysis::calculate_confusion | ( | void | ) | const |
Returns the confusion matrix of a neural network on the testing instances of a data set. If the number of outputs is one, the size of the confusion matrix is two. If the number of outputs is greater than one, the size of the confusion matrix is the number of outputs.
Definition at line 832 of file testing_analysis.cpp.
Matrix< size_t > OpenNN::TestingAnalysis::calculate_confusion_binary_classification | ( | const Matrix< double > & | actual_data, |
const Matrix< double > & | predicted_data | ||
) | const |
Returns the confusion matrix for a binary classification problem.
actual_data | Testing target data. |
predicted_data | Testing output data. |
Definition at line 744 of file testing_analysis.cpp.
Matrix< size_t > OpenNN::TestingAnalysis::calculate_confusion_multiple_classification | ( | const Matrix< double > & | actual_data, |
const Matrix< double > & | predicted_data | ||
) | const |
Returns the confusion matrix for a binary classification problem.
actual_data | Testing target data. |
predicted_data | Testing output data. |
Definition at line 804 of file testing_analysis.cpp.
Calculates the errors between the outputs from a neural network and the testing instances in a data set. It returns a vector of tree matrices:
The number of rows in each matrix is the number of testing instances in the data set. The number of columns is the number of outputs in the neural network.
Definition at line 545 of file testing_analysis.cpp.
Vector< Histogram< double > > OpenNN::TestingAnalysis::calculate_error_data_histograms | ( | const size_t & | bins_number = 10 | ) | const |
Calculates histograms for the relative errors of all the output variables. The number of bins is set by the user.
bins_number | Number of bins in the histograms. |
Definition at line 698 of file testing_analysis.cpp.
Vector< Vector< Statistics< double > > > OpenNN::TestingAnalysis::calculate_error_data_statistics | ( | void | ) | const |
Calculates the basic statistics on the error data.
Definition at line 642 of file testing_analysis.cpp.
Vector< Matrix< double > > OpenNN::TestingAnalysis::calculate_error_data_statistics_matrices | ( | void | ) | const |
Returns a vector of matrices with the statistics of the errors between the neural network outputs and the testing targets in the data set. The size of the vector is the number of output variables. The number of rows in each submatrix is three (absolute, relative and percentage errors). The number of columns in each submatrix is four (minimum, maximum, mean and standard deviation).
Definition at line 672 of file testing_analysis.cpp.
Vector< LinearRegressionParameters< double > > OpenNN::TestingAnalysis::calculate_linear_regression_parameters | ( | void | ) | const |
Performs a linear regression analysis between the testing instances in the data set and the corresponding neural network outputs. It returns all the provided parameters in a vector of vectors. The number of elements in the vector is equal to the number of output variables. The size of each element is equal to the number of regression parameters (2). In this way, each subvector contains the regression parameters intercept and slope of an output variable.
Definition at line 419 of file testing_analysis.cpp.
Vector< Vector< size_t > > OpenNN::TestingAnalysis::calculate_maximal_errors | ( | const size_t & | instances_number = 10 | ) | const |
Returns a vector with the indices of the instances which have the greatest error.
instances_number | Size of the vector to be returned. |
Definition at line 721 of file testing_analysis.cpp.
Returns a vector of matrices with number of rows equal to number of testing instances and number of columns equal to two (the targets value and the outputs value).
Definition at line 365 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::check | ( | void | ) | const |
Checks that:
Definition at line 336 of file testing_analysis.cpp.
|
virtual |
Deserializes a TinyXML document into this testing analysis object.
document | XML document containing the member data. |
Definition at line 1156 of file testing_analysis.cpp.
const bool & OpenNN::TestingAnalysis::get_display | ( | void | ) | const |
Returns true if messages from this class can be displayed on the screen, or false if messages from this class can't be displayed on the screen.
Definition at line 263 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::load | ( | const std::string & | file_name | ) |
Loads from a XML file the members for this testing analysis object.
file_name | Name of testing analysis XML file. |
Definition at line 1211 of file testing_analysis.cpp.
TestingAnalysis::LinearRegressionResults OpenNN::TestingAnalysis::perform_linear_regression_analysis | ( | void | ) | const |
Performs a linear regression analysis of a neural network on the testing indices of a data set. It returns a linear regression analysis results structure, which consists on:
Definition at line 488 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::save | ( | const std::string & | file_name | ) | const |
Saves to a XML file the members of this testing analysis object.
file_name | Name of testing analysis XML file. |
Definition at line 1196 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::set_data_set_pointer | ( | DataSet * | new_data_set_pointer | ) |
Sets a new data set to be used for validating the quality of a trained neural network.
new_data_set_pointer | Pointer to a data set object. |
Definition at line 309 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::set_default | ( | void | ) |
Sets some default values to the testing analysis object:
Definition at line 276 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::set_display | ( | const bool & | new_display | ) |
Sets a new display value. If it is set to true messages from this class are to be displayed on the screen; if it is set to false messages from this class are not to be displayed on the screen.
new_display | Display value. |
Definition at line 322 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::set_mathematical_model_pointer | ( | MathematicalModel * | new_mathematical_model_pointer | ) |
Sets a mathematical model to be used for validating the quality of a trained neural network.
new_mathematical_model_pointer | Pointer to a mathematical model object. |
Definition at line 298 of file testing_analysis.cpp.
void OpenNN::TestingAnalysis::set_neural_network_pointer | ( | NeuralNetwork * | new_neural_network_pointer | ) |
Sets a new neural network object to be tested.
new_neural_network_pointer | Pointer to a neural network object. |
Definition at line 287 of file testing_analysis.cpp.
|
virtual |
Serializes the testing analysis object into a XML document of the TinyXML library. See the OpenNN manual for more information about the format of this element.
Definition at line 1124 of file testing_analysis.cpp.