This class contains tools for testing neural networks in different learning tasks. More...
#include <testing_analysis.h>
Classes | |
struct | BinaryClassifcationRates |
Structure with the binary classification rates. More... | |
struct | KolmogorovSmirnovResults |
Structure with the results from Kolmogorov-Smirnov analysis. More... | |
struct | LinearRegressionAnalysis |
Structure with the results from a linear regression analysis. More... | |
struct | RocAnalysisResults |
Structure with the results from a roc curve analysis. More... | |
Public Member Functions | |
TestingAnalysis () | |
TestingAnalysis (NeuralNetwork *, DataSet *) | |
virtual | ~TestingAnalysis () |
NeuralNetwork * | get_neural_network_pointer () const |
Returns a pointer to the neural network object which is to be tested. More... | |
DataSet * | get_data_set_pointer () const |
Returns a pointer to the data set object on which the neural network is tested. More... | |
const bool & | get_display () const |
void | set_neural_network_pointer (NeuralNetwork *) |
void | set_data_set_pointer (DataSet *) |
void | set_display (const bool &) |
void | set_default () |
void | set_threads_number (const int &) |
void | check () const |
Tensor< type, 3 > | calculate_error_data () const |
Tensor< type, 2 > | calculate_percentage_error_data () const |
Tensor< Descriptives, 1 > | calculate_absolute_errors_descriptives () const |
Tensor< Descriptives, 1 > | calculate_absolute_errors_descriptives (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< Descriptives, 1 > | calculate_percentage_errors_descriptives () const |
Tensor< Descriptives, 1 > | calculate_percentage_errors_descriptives (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< Tensor< Descriptives, 1 >, 1 > | calculate_error_data_descriptives () const |
void | print_error_data_descriptives () const |
Tensor< Histogram, 1 > | calculate_error_data_histograms (const Index &=10) const |
Tensor< Tensor< Index, 1 >, 1 > | calculate_maximal_errors (const Index &=10) const |
Tensor< type, 2 > | calculate_errors () const |
Tensor< type, 2 > | calculate_binary_classification_errors () const |
Tensor< type, 2 > | calculate_multiple_classification_errors () const |
Tensor< type, 1 > | calculate_training_errors () const |
Tensor< type, 1 > | calculate_binary_classification_training_errors () const |
Tensor< type, 1 > | calculate_multiple_classification_training_errors () const |
Tensor< type, 1 > | calculate_selection_errors () const |
Tensor< type, 1 > | calculate_binary_classification_selection_errors () const |
Tensor< type, 1 > | calculate_multiple_classification_selection_errors () const |
Tensor< type, 1 > | calculate_testing_errors () const |
Tensor< type, 1 > | calculate_binary_classification_testing_errors () const |
Tensor< type, 1 > | calculate_multiple_classification_testing_errors () const |
type | calculate_normalized_squared_error (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
type | calculate_cross_entropy_error (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
type | calculate_weighted_squared_error (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< type, 1 > &=Tensor< type, 1 >()) const |
type | calculate_Minkowski_error (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const type=type(1.5)) const |
Tensor< Correlation, 1 > | linear_correlation () const |
Tensor< Correlation, 1 > | linear_correlation (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
void | print_linear_regression_correlations () const |
Tensor< LinearRegressionAnalysis, 1 > | perform_linear_regression_analysis () const |
void | print_linear_regression_analysis () const |
Tensor< type, 1 > | calculate_binary_classification_tests () const |
void | print_binary_classification_tests () const |
type | calculate_logloss () const |
Returns the logloss for a binary classification problem. More... | |
Tensor< Index, 2 > | calculate_confusion_binary_classification (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const type &) const |
Tensor< Index, 2 > | calculate_confusion_multiple_classification (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< Index, 1 > | calculate_positives_negatives_rate (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< Index, 2 > | calculate_confusion (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< Index, 2 > | calculate_confusion () const |
RocAnalysisResults | perform_roc_analysis () const |
type | calculate_Wilcoxon_parameter (const type &, const type &) const |
Tensor< type, 2 > | calculate_roc_curve (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
type | calculate_area_under_curve (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
type | calculate_area_under_curve (const Tensor< type, 2 > &) const |
type | calculate_area_under_curve_confidence_limit (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
type | calculate_area_under_curve_confidence_limit (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const type &) const |
type | calculate_optimal_threshold (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
type | calculate_optimal_threshold (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< type, 2 > | perform_cumulative_gain_analysis () const |
Tensor< type, 2 > | calculate_cumulative_gain (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< type, 2 > | calculate_negative_cumulative_gain (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< type, 2 > | perform_lift_chart_analysis () const |
Tensor< type, 2 > | calculate_lift_chart (const Tensor< type, 2 > &) const |
KolmogorovSmirnovResults | perform_Kolmogorov_Smirnov_analysis () const |
Tensor< type, 1 > | calculate_maximum_gain (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< type, 2 > | perform_calibration_plot_analysis () const |
Performs a calibration plot analysis. More... | |
Tensor< type, 2 > | calculate_calibration_plot (const Tensor< type, 2 > &, const Tensor< type, 2 > &) const |
Tensor< Histogram, 1 > | calculate_output_histogram (const Tensor< type, 2 > &, const Index &=10) const |
BinaryClassifcationRates | calculate_binary_classification_rates () const |
Tensor< Index, 1 > | calculate_true_positive_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const |
Tensor< Index, 1 > | calculate_false_positive_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const |
Tensor< Index, 1 > | calculate_false_negative_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const |
Tensor< Index, 1 > | calculate_true_negative_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const |
Tensor< type, 1 > | calculate_multiple_classification_tests () const |
void | save_confusion (const string &) const |
void | save_multiple_classification_tests (const string &) const |
Tensor< Tensor< Index, 1 >, 2 > | calculate_multiple_classification_rates () const |
Returns a matrix of subvectors which have the rates for a multiple classification problem. More... | |
Tensor< Tensor< Index, 1 >, 2 > | calculate_multiple_classification_rates (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &) const |
Tensor< string, 2 > | calculate_well_classified_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &) |
Tensor< string, 2 > | calculate_misclassified_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &) |
void | save_well_classified_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &, const string &) |
void | save_misclassified_samples (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &, const string &) |
void | save_well_classified_samples_statistics (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &, const string &) |
void | save_misclassified_samples_statistics (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &, const string &) |
void | save_well_classified_samples_probability_histogram (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &, const string &) |
void | save_well_classified_samples_probability_histogram (const Tensor< string, 2 > &, const string &) |
void | save_misclassified_samples_probability_histogram (const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< string, 1 > &, const string &) |
void | save_misclassified_samples_probability_histogram (const Tensor< string, 2 > &, const string &) |
Tensor< Tensor< type, 1 >, 1 > | calculate_error_autocorrelation (const Index &=10) const |
Tensor< Tensor< type, 1 >, 1 > | calculate_inputs_errors_cross_correlation (const Index &=10) const |
void | print () const |
Prints to the standard output the string representation of this testing analysis object. More... | |
virtual void | from_XML (const tinyxml2::XMLDocument &) |
virtual void | write_XML (tinyxml2::XMLPrinter &) const |
void | save (const string &) const |
void | load (const string &) |
bool | contains (const Tensor< type, 1 > &, const type &) const |
Tensor< type, 2 > | delete_row (const Tensor< type, 2 > &, const Index &) const |
Private Attributes | |
NonBlockingThreadPool * | non_blocking_thread_pool = nullptr |
ThreadPoolDevice * | thread_pool_device = nullptr |
NeuralNetwork * | neural_network_pointer = nullptr |
Pointer to the neural network object to be tested. More... | |
DataSet * | data_set_pointer = nullptr |
Pointer to a data set object. More... | |
bool | display = true |
Display messages to screen. More... | |
const Eigen::array< IndexPair< Index >, 2 > | SSE = {IndexPair<Index>(0, 0), IndexPair<Index>(1, 1)} |
This class contains tools for testing neural networks in different learning tasks.
In particular, it can be used for testing function regression, classification or time series prediction problems.
Definition at line 41 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 18 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 32 of file testing_analysis.cpp.
|
virtual |
Destructor. It deletes the function regression testing, classification testing, time series prediction testing and inverse problem testing objects.
Definition at line 45 of file testing_analysis.cpp.
Tensor< Descriptives, 1 > calculate_absolute_errors_descriptives | ( | ) | const |
Definition at line 497 of file testing_analysis.cpp.
Tensor< Descriptives, 1 > calculate_absolute_errors_descriptives | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Definition at line 514 of file testing_analysis.cpp.
type calculate_area_under_curve | ( | const Tensor< type, 2 > & | roc_curve | ) | const |
Returns the area under a ROC curve using trapezoidal integration.
roc_curve | ROC curve. |
Definition at line 1928 of file testing_analysis.cpp.
type calculate_area_under_curve | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns the area under a ROC curve using Wilcoxon parameter test.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 1868 of file testing_analysis.cpp.
type calculate_area_under_curve_confidence_limit | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns the confidence limit for the area under a roc curve.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 1945 of file testing_analysis.cpp.
type calculate_area_under_curve_confidence_limit | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const type & | area_under_curve | ||
) | const |
Returns the confidence limit for the area under a roc curve.
targets | Testing target data. |
outputs | Testing output data. |
area_under_curve | Area under curve. |
Definition at line 1992 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_binary_classification_errors | ( | ) | const |
Definition at line 694 of file testing_analysis.cpp.
TestingAnalysis::BinaryClassifcationRates calculate_binary_classification_rates | ( | ) | const |
Returns a structure with the binary classification rates, which has the indices of the true positive, false negative, false positive and true negative samples.
Definition at line 2736 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_binary_classification_selection_errors | ( | ) | const |
Definition at line 974 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_binary_classification_testing_errors | ( | ) | const |
Returns a vector containing the values of the errors between the outputs of the neural network and the targets for a binary classification problem. The vector consists of:
Definition at line 1147 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_binary_classification_tests | ( | ) | const |
Returns the results of a binary classification test in a single vector. The size of that vector is fifteen. The elements are:
Definition at line 3577 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_binary_classification_training_errors | ( | ) | const |
Definition at line 813 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_calibration_plot | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns a matix with the values of a calibration plot. Number of columns is two. Number of rows varies depending on the distribution of positive targets.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 2629 of file testing_analysis.cpp.
Tensor< Index, 2 > calculate_confusion | ( | ) | const |
Returns the confusion matrix of a neural network on the testing samples 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 1553 of file testing_analysis.cpp.
Tensor< Index, 2 > calculate_confusion_binary_classification | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const type & | decision_threshold | ||
) | const |
Returns the confusion matrix for a binary classification problem.
targets | Testing target data. |
outputs | Testing output data. |
decision_threshold | Decision threshold. |
Definition at line 1420 of file testing_analysis.cpp.
Tensor< Index, 2 > calculate_confusion_multiple_classification | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns the confusion matrix for a binary classification problem.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 1495 of file testing_analysis.cpp.
type calculate_cross_entropy_error | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns the cross-entropy error between the targets and the outputs of the neural network. It can only be computed for classification problems.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 1291 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_cumulative_gain | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns a matrix with the values of a cumulative gain chart. The number of columns is two, the number of rows is 20.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 2208 of file testing_analysis.cpp.
Tensor< Tensor< type, 1 >, 1 > calculate_error_autocorrelation | ( | const Index & | maximum_lags_number = 10 | ) | const |
Calculates error autocorrelation across varying lags. Returns a vector of subvectors. The size of the vector is the number of targets. The size of the subvectors is the number of lags for which autocorrelation is calculated.
maximum_lags_number | Number of lags for which error autocorrelation is to be calculated. |
Definition at line 3414 of file testing_analysis.cpp.
Tensor< type, 3 > calculate_error_data | ( | ) | const |
Calculates the errors between the outputs from a neural network and the testing samples in a data set. It returns a vector of tree matrices:
The number of rows in each matrix is the number of testing samples in the data set. The number of columns is the number of outputs in the neural network.
Definition at line 340 of file testing_analysis.cpp.
Tensor< Tensor< Descriptives, 1 >, 1 > calculate_error_data_descriptives | ( | ) | const |
Calculates the basic descriptives on the error data.
Definition at line 557 of file testing_analysis.cpp.
Tensor< Histogram, 1 > calculate_error_data_histograms | ( | const Index & | 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 617 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_errors | ( | ) | const |
This method calculates the training, selection and testing errors. Returns a matrix with the differents errors.
Definition at line 664 of file testing_analysis.cpp.
Tensor< Index, 1 > calculate_false_negative_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< Index, 1 > & | testing_indices, | ||
const type & | decision_threshold | ||
) | const |
Returns a vector with the indices of the false negative samples. The size of the vector is the number of false negative samples.
targets | Testing target data. |
outputs | Testing output data. |
testing_indices | Indices of the testing data |
decision_threshold | Decision threshold. |
Definition at line 2886 of file testing_analysis.cpp.
Tensor< Index, 1 > calculate_false_positive_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< Index, 1 > & | testing_indices, | ||
const type & | decision_threshold | ||
) | const |
Returns a vector with the indices of the false positive samples. The size of the vector is the number of false positive samples.
targets | Testing target data. |
outputs | Testing output data. |
testing_indices | Indices of the testing data |
decision_threshold | Decision threshold. |
Definition at line 2853 of file testing_analysis.cpp.
Tensor< Tensor< type, 1 >, 1 > calculate_inputs_errors_cross_correlation | ( | const Index & | lags_number = 10 | ) | const |
Calculates the correlation between input and error. Returns a vector of subvectors. The size of the vector is the number of targets. The size of the subvectors is the number of lags for which cross-correlation is calculated.
maximum_lags_number | Number of lags for which cross-correlation is calculated. |
Definition at line 3487 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_lift_chart | ( | const Tensor< type, 2 > & | cumulative_gain | ) | const |
Returns a matrix with the values of lift chart for a given cumulative gain chart. Size is the same as the cumulative lift chart one.
cumulative_gain | A cumulative gain chart. |
Definition at line 2420 of file testing_analysis.cpp.
type calculate_logloss | ( | ) | const |
Returns the logloss for a binary classification problem.
Definition at line 3875 of file testing_analysis.cpp.
Tensor< Tensor< Index, 1 >, 1 > calculate_maximal_errors | ( | const Index & | samples_number = 10 | ) | const |
Returns a vector with the indices of the samples which have the greatest error.
samples_number | Number of maximal indices to be computed. |
Definition at line 637 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_maximum_gain | ( | const Tensor< type, 2 > & | positive_cumulative_gain, |
const Tensor< type, 2 > & | negative_cumulative_gain | ||
) | const |
Returns the score of the the maximum gain, which is the point of major separation between the positive and the negative cumulative gain charts, and the samples ratio for which it occurs.
positive_cumulative_gain | Cumulative gain fo the positive samples. |
negative_cumulative_gain | Cumulative gain fo the negative samples. |
Definition at line 2522 of file testing_analysis.cpp.
type calculate_Minkowski_error | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const type | minkowski_parameter = type(1.5) |
||
) | const |
Definition at line 1407 of file testing_analysis.cpp.
Tensor< string, 2 > calculate_misclassified_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels | ||
) |
Definition at line 3182 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_multiple_classification_errors | ( | ) | const |
Definition at line 730 of file testing_analysis.cpp.
Tensor< Tensor< Index, 1 >, 2 > calculate_multiple_classification_rates | ( | ) | const |
Returns a matrix of subvectors which have the rates for a multiple classification problem.
Definition at line 3034 of file testing_analysis.cpp.
Tensor< Tensor< Index, 1 >, 2 > calculate_multiple_classification_rates | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< Index, 1 > & | testing_indices | ||
) | const |
Returns a matrix of subvectors which have the rates for a multiple classification problem. The number of rows of the matrix is the number targets. The number of columns of the matrix is the number of columns of the target data.
Definition at line 3096 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_multiple_classification_selection_errors | ( | ) | const |
Definition at line 1026 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_multiple_classification_testing_errors | ( | ) | const |
Returns a vector containing the values of the errors between the outputs of the neural network and the targets for a multiple classification problem. The vector consists of:
Definition at line 1209 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_multiple_classification_tests | ( | ) | const |
Definition at line 2945 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_multiple_classification_training_errors | ( | ) | const |
Definition at line 874 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_negative_cumulative_gain | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns a matrix with the values of a cumulative gain chart for the negative samples. The number of columns is two, the number of rows is 20.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 2284 of file testing_analysis.cpp.
type calculate_normalized_squared_error | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns the normalized squared error between the targets and the outputs of the neural network.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 1263 of file testing_analysis.cpp.
type calculate_optimal_threshold | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns the point of optimal classification accuracy, which is the nearest ROC curve point to the upper left corner(0,1).
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 2036 of file testing_analysis.cpp.
type calculate_optimal_threshold | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< type, 2 > & | roc_curve | ||
) | const |
Returns the point of optimal classification accuracy, which is the nearest ROC curve point to the upper left corner(0,1).
targets | Testing target data. |
outputs | Testing output data. |
roc_curve | ROC curve. |
Definition at line 2109 of file testing_analysis.cpp.
Tensor< Histogram, 1 > calculate_output_histogram | ( | const Tensor< type, 2 > & | outputs, |
const Index & | bins_number = 10 |
||
) | const |
Returns the histogram of the outputs.
outputs | Testing output data. |
bins_number | Number of bins of the histogram. |
Definition at line 2716 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_percentage_error_data | ( | ) | const |
Calculates the percentege errors between the outputs from a neural network and the testing samples in a data set. The number of rows in each matrix is the number of testing samples in the data set.
Definition at line 424 of file testing_analysis.cpp.
Tensor< Descriptives, 1 > calculate_percentage_errors_descriptives | ( | ) | const |
Definition at line 523 of file testing_analysis.cpp.
Tensor< Descriptives, 1 > calculate_percentage_errors_descriptives | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Definition at line 540 of file testing_analysis.cpp.
Tensor< Index, 1 > calculate_positives_negatives_rate | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns a vector containing the number of total positives and the number of total negatives samples of a data set. The size of the vector is two and consists of:
Definition at line 1537 of file testing_analysis.cpp.
Tensor< type, 2 > calculate_roc_curve | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs | ||
) | const |
Returns a matrix with the values of a ROC curve for a binary classification problem. The number of columns is three. The third column contains the decision threshold. The number of rows is one more than the number of outputs if the number of outputs is lower than 100 or 50 in other case.
targets | Testing target data. |
outputs | Testing output data. |
Definition at line 1740 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_selection_errors | ( | ) | const |
Definition at line 924 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_testing_errors | ( | ) | const |
Returns a vector containing the values of the errors between the outputs of the neural network and the targets. The vector consists of:
Definition at line 1086 of file testing_analysis.cpp.
Tensor< type, 1 > calculate_training_errors | ( | ) | const |
Definition at line 763 of file testing_analysis.cpp.
Tensor< Index, 1 > calculate_true_negative_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< Index, 1 > & | testing_indices, | ||
const type & | decision_threshold | ||
) | const |
Returns a vector with the indices of the true negative samples. The size of the vector is the number of true negative samples.
targets | Testing target data. |
outputs | Testinga output data. |
testing_indices | Indices of the testing data |
decision_threshold | Decision threshold. |
Definition at line 2919 of file testing_analysis.cpp.
Tensor< Index, 1 > calculate_true_positive_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< Index, 1 > & | testing_indices, | ||
const type & | decision_threshold | ||
) | const |
Returns a vector with the indices of the true positive samples. The size of the vector is the number of true positive samples.
targets | Testing target data. |
outputs | Testing outputs. |
testing_indices | Indices of testing data. |
decision_threshold | Decision threshold. |
Definition at line 2819 of file testing_analysis.cpp.
type calculate_weighted_squared_error | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< type, 1 > & | weights = Tensor<type, 1>() |
||
) | const |
Returns the weighted squared error between the targets and the outputs of the neural network. It can only be computed for binary classification problems.
targets | Testing target data. |
outputs | Testing output data. |
weights | Weights of the postitives and negatives to evaluate. |
Definition at line 1335 of file testing_analysis.cpp.
Tensor< string, 2 > calculate_well_classified_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels | ||
) |
Definition at line 3139 of file testing_analysis.cpp.
type calculate_Wilcoxon_parameter | ( | const type & | x, |
const type & | y | ||
) | const |
Calculates the Wilcoxon parameter, which is used for calculating the area under a ROC curve. Returns 1 if first value is greater than second one, 0 if second value is greater than first one or 0.5 in other case.
x | Target data value. |
y | Target data value. |
Definition at line 1716 of file testing_analysis.cpp.
void check | ( | ) | const |
Checks that:
Definition at line 168 of file testing_analysis.cpp.
bool contains | ( | const Tensor< type, 1 > & | tensor, |
const type & | value | ||
) | const |
Definition at line 4049 of file testing_analysis.cpp.
Tensor< type, 2 > delete_row | ( | const Tensor< type, 2 > & | tensor, |
const Index & | row_index | ||
) | const |
Definition at line 4058 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 3974 of file testing_analysis.cpp.
DataSet * get_data_set_pointer | ( | ) | const |
Returns a pointer to the data set object on which the neural network is tested.
Definition at line 77 of file testing_analysis.cpp.
const bool & get_display | ( | ) | 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 101 of file testing_analysis.cpp.
NeuralNetwork * get_neural_network_pointer | ( | ) | const |
Returns a pointer to the neural network object which is to be tested.
Definition at line 54 of file testing_analysis.cpp.
Tensor< Correlation, 1 > linear_correlation | ( | ) | const |
Performs a linear regression analysis between the testing samples 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 199 of file testing_analysis.cpp.
Tensor< Correlation, 1 > linear_correlation | ( | const Tensor< type, 2 > & | target, |
const Tensor< type, 2 > & | output | ||
) | const |
Definition at line 232 of file testing_analysis.cpp.
void load | ( | const 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 4029 of file testing_analysis.cpp.
Tensor< type, 2 > perform_calibration_plot_analysis | ( | ) | const |
Performs a calibration plot analysis.
Definition at line 2565 of file testing_analysis.cpp.
Tensor< type, 2 > perform_cumulative_gain_analysis | ( | ) | const |
Performs a cumulative gain analysis. Returns a matrix with the values of a cumulative gain chart.
Definition at line 2137 of file testing_analysis.cpp.
TestingAnalysis::KolmogorovSmirnovResults perform_Kolmogorov_Smirnov_analysis | ( | ) | const |
Performs a Kolmogorov-Smirnov analysis, which consists of the cumulative gain for the positive samples and the cumulative gain for the negative samples. It returns a Kolmogorov-Smirnov results structure, which consists of:
Definition at line 2450 of file testing_analysis.cpp.
Tensor< type, 2 > perform_lift_chart_analysis | ( | ) | const |
Performs a lift chart analysis. Returns a matrix with the values of a lift chart.
Definition at line 2357 of file testing_analysis.cpp.
Tensor< TestingAnalysis::LinearRegressionAnalysis, 1 > perform_linear_regression_analysis | ( | ) | 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 of:
Definition at line 269 of file testing_analysis.cpp.
TestingAnalysis::RocAnalysisResults perform_roc_analysis | ( | ) | const |
Performs a ROC curve analysis. It returns a ROC curve analysis results structure, which consists of:
Definition at line 1636 of file testing_analysis.cpp.
void print | ( | ) | const |
Prints to the standard output the string representation of this testing analysis object.
Definition at line 3942 of file testing_analysis.cpp.
void print_binary_classification_tests | ( | ) | const |
Definition at line 3861 of file testing_analysis.cpp.
void print_error_data_descriptives | ( | ) | const |
Definition at line 588 of file testing_analysis.cpp.
void print_linear_regression_analysis | ( | ) | const |
Definition at line 319 of file testing_analysis.cpp.
void print_linear_regression_correlations | ( | ) | const |
Definition at line 247 of file testing_analysis.cpp.
void save | ( | const 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 4012 of file testing_analysis.cpp.
void save_confusion | ( | const string & | confusion_file_name | ) | const |
Definition at line 2975 of file testing_analysis.cpp.
void save_misclassified_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels, | ||
const string & | misclassified_samples_file_name | ||
) |
Definition at line 3258 of file testing_analysis.cpp.
void save_misclassified_samples_probability_histogram | ( | const Tensor< string, 2 > & | misclassified_samples, |
const string & | histogram_file_name | ||
) |
Definition at line 3392 of file testing_analysis.cpp.
void save_misclassified_samples_probability_histogram | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels, | ||
const string & | histogram_file_name | ||
) |
Definition at line 3371 of file testing_analysis.cpp.
void save_misclassified_samples_statistics | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels, | ||
const string & | statistics_file_name | ||
) |
Definition at line 3308 of file testing_analysis.cpp.
void save_multiple_classification_tests | ( | const string & | classification_tests_file_name | ) | const |
Definition at line 3019 of file testing_analysis.cpp.
void save_well_classified_samples | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels, | ||
const string & | well_classified_samples_file_name | ||
) |
Definition at line 3236 of file testing_analysis.cpp.
void save_well_classified_samples_probability_histogram | ( | const Tensor< string, 2 > & | well_classified_samples, |
const string & | histogram_file_name | ||
) |
Definition at line 3355 of file testing_analysis.cpp.
void save_well_classified_samples_probability_histogram | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels, | ||
const string & | histogram_file_name | ||
) |
Definition at line 3334 of file testing_analysis.cpp.
void save_well_classified_samples_statistics | ( | const Tensor< type, 2 > & | targets, |
const Tensor< type, 2 > & | outputs, | ||
const Tensor< string, 1 > & | labels, | ||
const string & | statistics_file_name | ||
) |
Definition at line 3280 of file testing_analysis.cpp.
void 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 145 of file testing_analysis.cpp.
void set_default | ( | ) |
Sets some default values to the testing analysis object:
Definition at line 112 of file testing_analysis.cpp.
void 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 156 of file testing_analysis.cpp.
void 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 136 of file testing_analysis.cpp.
void set_threads_number | ( | const int & | new_threads_number | ) |
Definition at line 123 of file testing_analysis.cpp.
|
virtual |
Serializes the testing analysis object into a XML document of the TinyXML library without keep the DOM tree in memory. See the OpenNN manual for more information about the format of this document.
Definition at line 3950 of file testing_analysis.cpp.
|
private |
Pointer to a data set object.
Definition at line 347 of file testing_analysis.h.
|
private |
Display messages to screen.
Definition at line 351 of file testing_analysis.h.
|
private |
Pointer to the neural network object to be tested.
Definition at line 343 of file testing_analysis.h.
|
private |
Definition at line 338 of file testing_analysis.h.
|
private |
Definition at line 353 of file testing_analysis.h.
|
private |
Definition at line 339 of file testing_analysis.h.