TestingAnalysis Class Reference

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 *)
 
 TestingAnalysis (DataSet *)
 
 TestingAnalysis (NeuralNetwork *, DataSet *)
 
 TestingAnalysis (const tinyxml2::XMLDocument &)
 
 TestingAnalysis (const string &)
 
virtual ~TestingAnalysis ()
 
NeuralNetworkget_neural_network_pointer () const
 Returns a pointer to the neural network object which is to be tested.
 
DataSetget_data_set_pointer () const
 Returns a pointer to the data set object on which the neural network is tested.
 
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 check () const
 
Vector< Matrix< double > > calculate_error_data () const
 
Vector< Vector< double > > calculate_percentage_error_data () const
 
Vector< Descriptivescalculate_absolute_errors_statistics () const
 
Vector< Descriptivescalculate_absolute_errors_statistics (const Tensor< double > &, const Tensor< double > &) const
 
Vector< Descriptivescalculate_percentage_errors_statistics () const
 
Vector< Descriptivescalculate_percentage_errors_statistics (const Tensor< double > &, const Tensor< double > &) const
 
Vector< Vector< Descriptives > > calculate_error_data_statistics () const
 
void print_error_data_statistics () const
 
Vector< Matrix< double > > calculate_error_data_statistics_matrices () const
 
Vector< Histogramcalculate_error_data_histograms (const size_t &=10) const
 
Vector< Vector< size_t > > calculate_maximal_errors (const size_t &=10) const
 
Matrix< double > calculate_errors () const
 
Matrix< double > calculate_binary_classification_errors () const
 
Matrix< double > calculate_multiple_classification_errors () const
 
Vector< double > calculate_training_errors () const
 
Vector< double > calculate_binary_classification_training_errors () const
 
Vector< double > calculate_multiple_classification_training_errors () const
 
Vector< double > calculate_selection_errors () const
 
Vector< double > calculate_binary_classification_selection_errors () const
 
Vector< double > calculate_multiple_classification_selection_errors () const
 
Vector< double > calculate_testing_errors () const
 
Vector< double > calculate_binary_classification_testing_errors () const
 
Vector< double > calculate_multiple_classification_testing_errors () const
 
double calculate_testing_normalized_squared_error (const Tensor< double > &, const Tensor< double > &) const
 
double calculate_testing_cross_entropy_error (const Tensor< double > &, const Tensor< double > &) const
 
double calculate_testing_weighted_squared_error (const Tensor< double > &, const Tensor< double > &, const Vector< double > &=Vector< double >()) const
 
Vector< RegressionResultslinear_regression () const
 
Vector< RegressionResultslinear_regression (const Tensor< double > &, const Tensor< double > &) const
 
void print_linear_regression_correlations () const
 
vector< double > get_linear_regression_correlations_std () const
 
Vector< LinearRegressionAnalysisperform_linear_regression_analysis () const
 
void perform_linear_regression_analysis_void () const
 
Vector< double > calculate_binary_classification_tests () const
 
double calculate_logloss () const
 Returns the logloss for a binary classification problem.
 
Matrix< size_t > calculate_confusion_binary_classification (const Tensor< double > &, const Tensor< double > &, const double &) const
 
Matrix< size_t > calculate_confusion_multiple_classification (const Tensor< double > &, const Tensor< double > &) const
 
Vector< size_t > calculate_positives_negatives_rate (const Tensor< double > &, const Tensor< double > &) const
 
Matrix< size_t > calculate_confusion (const Matrix< double > &, const Matrix< double > &) const
 
Matrix< size_t > calculate_confusion () const
 
RocAnalysisResults perform_roc_analysis () const
 
double calculate_Wilcoxon_parameter (const double &, const double &) const
 
Matrix< double > calculate_roc_curve (const Tensor< double > &, const Tensor< double > &) const
 
double calculate_area_under_curve (const Tensor< double > &, const Tensor< double > &) const
 
double calculate_area_under_curve_confidence_limit (const Tensor< double > &, const Tensor< double > &) const
 
double calculate_area_under_curve_confidence_limit (const Tensor< double > &, const Tensor< double > &, const double &) const
 
double calculate_optimal_threshold (const Tensor< double > &, const Tensor< double > &) const
 
double calculate_optimal_threshold (const Tensor< double > &, const Tensor< double > &, const Matrix< double > &) const
 
Matrix< double > perform_cumulative_gain_analysis () const
 
Matrix< double > calculate_cumulative_gain (const Tensor< double > &, const Tensor< double > &) const
 
Matrix< double > calculate_negative_cumulative_gain (const Tensor< double > &, const Tensor< double > &) const
 
Matrix< double > perform_lift_chart_analysis () const
 
Matrix< double > calculate_lift_chart (const Matrix< double > &) const
 
KolmogorovSmirnovResults perform_Kolmogorov_Smirnov_analysis () const
 
Vector< double > calculate_maximum_gain (const Matrix< double > &, const Matrix< double > &) const
 
Matrix< double > perform_calibration_plot_analysis () const
 Performs a calibration plot analysis.
 
Matrix< double > calculate_calibration_plot (const Tensor< double > &, const Tensor< double > &) const
 
Vector< Histogramcalculate_output_histogram (const Tensor< double > &, const size_t &=10) const
 
BinaryClassifcationRates calculate_binary_classification_rates () const
 
Vector< size_t > calculate_true_positive_instances (const Tensor< double > &, const Tensor< double > &, const Vector< size_t > &, const double &) const
 
Vector< size_t > calculate_false_positive_instances (const Tensor< double > &, const Tensor< double > &, const Vector< size_t > &, const double &) const
 
Vector< size_t > calculate_false_negative_instances (const Tensor< double > &, const Tensor< double > &, const Vector< size_t > &, const double &) const
 
Vector< size_t > calculate_true_negative_instances (const Tensor< double > &, const Tensor< double > &, const Vector< size_t > &, const double &) const
 
Matrix< Vector< size_t > > calculate_multiple_classification_rates () const
 Returns a matrix of subvectors which have the rates for a multiple classification problem.
 
Matrix< Vector< size_t > > calculate_multiple_classification_rates (const Tensor< double > &, const Tensor< double > &, const Vector< size_t > &) const
 
Vector< Vector< double > > calculate_error_autocorrelation (const size_t &=10) const
 
Vector< Vector< double > > calculate_inputs_errors_cross_correlation (const size_t &=10) const
 
string object_to_string () const
 Returns a string representation of the testing analysis object.
 
void print () const
 Prints to the standard output the string representation of this testing analysis object.
 
virtual tinyxml2::XMLDocumentto_XML () const
 
virtual void from_XML (const tinyxml2::XMLDocument &)
 
virtual void write_XML (tinyxml2::XMLPrinter &) const
 
void save (const string &) const
 
void load (const string &)
 

Private Attributes

NeuralNetworkneural_network_pointer = nullptr
 Pointer to the neural network object to be tested.
 
DataSetdata_set_pointer = nullptr
 Pointer to a data set object.
 
bool display
 Display messages to screen.
 

Detailed Description

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 39 of file testing_analysis.h.

Constructor & Destructor Documentation

◆ TestingAnalysis() [1/6]

TestingAnalysis ( )
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.

◆ TestingAnalysis() [2/6]

TestingAnalysis ( NeuralNetwork new_neural_network_pointer)
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.

Parameters
new_neural_network_pointerPointer to a neural network object.

Definition at line 32 of file testing_analysis.cpp.

◆ TestingAnalysis() [3/6]

TestingAnalysis ( DataSet new_data_set_pointer)
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.

Parameters
new_data_set_pointerPointer to a data set object.

Definition at line 45 of file testing_analysis.cpp.

◆ TestingAnalysis() [4/6]

TestingAnalysis ( NeuralNetwork new_neural_network_pointer,
DataSet new_data_set_pointer 
)
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.

Parameters
new_neural_network_pointerPointer to a neural network object.
new_data_set_pointerPointer to a data set object.

Definition at line 59 of file testing_analysis.cpp.

◆ TestingAnalysis() [5/6]

TestingAnalysis ( const tinyxml2::XMLDocument testing_analysis_document)
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.

Parameters
testing_analysis_documentXML document containing the member data.

Definition at line 74 of file testing_analysis.cpp.

◆ TestingAnalysis() [6/6]

TestingAnalysis ( const string &  file_name)
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.

Parameters
file_nameName of testing analysis XML file.

Definition at line 89 of file testing_analysis.cpp.

◆ ~TestingAnalysis()

~TestingAnalysis ( )
virtual

Destructor. It deletes the function regression testing, classification testing, time series prediction testing and inverse problem testing objects.

Definition at line 102 of file testing_analysis.cpp.

Member Function Documentation

◆ calculate_area_under_curve()

double calculate_area_under_curve ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns the area under a ROC curve.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1813 of file testing_analysis.cpp.

◆ calculate_area_under_curve_confidence_limit() [1/2]

double calculate_area_under_curve_confidence_limit ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns the confidence limit for the area under a roc curve.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1874 of file testing_analysis.cpp.

◆ calculate_area_under_curve_confidence_limit() [2/2]

double calculate_area_under_curve_confidence_limit ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const double &  area_under_curve 
) const

Returns the confidence limit for the area under a roc curve.

Parameters
targetsTesting target data.
outputsTesting output data.
area_under_curveArea under curve.

Definition at line 1921 of file testing_analysis.cpp.

◆ calculate_binary_classification_rates()

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 instances.

  • True positive instances
  • False positive instances
  • False negative instances
  • True negative instances

Definition at line 2689 of file testing_analysis.cpp.

◆ calculate_binary_classification_testing_errors()

Vector< double > 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:

  • Sum squared error.
  • Mean squared error.
  • Root mean squared error.
  • Normalized squared error.
  • Cross-entropy error.
  • Weighted squared error.

Definition at line 1158 of file testing_analysis.cpp.

◆ calculate_binary_classification_tests()

Vector< double > 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:

  • Classification accuracy
  • Error rate
  • Sensitivity
  • Specificity
  • Precision
  • Positive likelihood
  • Negative likelihood
  • F1 score
  • False positive rate
  • False discovery rate
  • False negative rate
  • Negative predictive value
  • Matthews correlation coefficient
  • Informedness
  • Markedness

Definition at line 3135 of file testing_analysis.cpp.

◆ calculate_calibration_plot()

Matrix< double > calculate_calibration_plot ( const Tensor< double > &  targets,
const Tensor< double > &  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.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 2583 of file testing_analysis.cpp.

◆ calculate_confusion()

Matrix< size_t > calculate_confusion ( ) 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 1532 of file testing_analysis.cpp.

◆ calculate_confusion_binary_classification()

Matrix< size_t > calculate_confusion_binary_classification ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const double &  decision_threshold 
) const

Returns the confusion matrix for a binary classification problem.

Parameters
targetsTesting target data.
outputsTesting output data.
decision_thresholdDecision threshold.

Definition at line 1423 of file testing_analysis.cpp.

◆ calculate_confusion_multiple_classification()

Matrix< size_t > calculate_confusion_multiple_classification ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns the confusion matrix for a binary classification problem.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1486 of file testing_analysis.cpp.

◆ calculate_cumulative_gain()

Matrix< double > calculate_cumulative_gain ( const Tensor< double > &  targets,
const Tensor< double > &  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.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 2169 of file testing_analysis.cpp.

◆ calculate_error_autocorrelation()

Vector< Vector< double > > calculate_error_autocorrelation ( const size_t &  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.

Parameters
maximum_lags_numberNumber of lags for which error autocorrelation is to be calculated.

Definition at line 2970 of file testing_analysis.cpp.

◆ calculate_error_data()

Vector< Matrix< double > > calculate_error_data ( ) const

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:

  • Absolute error.
  • Relative error.
  • Percentage error.

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 401 of file testing_analysis.cpp.

◆ calculate_error_data_histograms()

Vector< Histogram > 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.

Parameters
bins_numberNumber of bins in the histograms.

Definition at line 711 of file testing_analysis.cpp.

◆ calculate_error_data_statistics()

Vector< Vector< Descriptives > > calculate_error_data_statistics ( ) const

Calculates the basic descriptives on the error data.

  • Minimum.
  • Maximum.
  • Mean.
  • Standard deviation

Definition at line 634 of file testing_analysis.cpp.

◆ calculate_error_data_statistics_matrices()

Vector< Matrix< double > > calculate_error_data_statistics_matrices ( ) const

Returns a vector of matrices with the descriptives 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 two(absolute and percentage errors). The number of columns in each submatrix is four(minimum, maximum, mean and standard deviation).

Definition at line 688 of file testing_analysis.cpp.

◆ calculate_errors()

Matrix< double > calculate_errors ( ) const

This method calculates the training, selection and testing errors. Returns a matrix with the differents errors.

Definition at line 751 of file testing_analysis.cpp.

◆ calculate_false_negative_instances()

Vector< size_t > calculate_false_negative_instances ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Vector< size_t > &  testing_indices,
const double &  decision_threshold 
) const

Returns a vector with the indices of the false negative instances. The size of the vector is the number of false negative instances.

Parameters
targetsTesting target data.
outputsTesting output data.
testing_indicesIndices of the testing data
decision_thresholdDecision threshold.

Definition at line 2826 of file testing_analysis.cpp.

◆ calculate_false_positive_instances()

Vector< size_t > calculate_false_positive_instances ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Vector< size_t > &  testing_indices,
const double &  decision_threshold 
) const

Returns a vector with the indices of the false positive instances. The size of the vector is the number of false positive instances.

Parameters
targetsTesting target data.
outputsTesting output data.
testing_indicesIndices of the testing data
decision_thresholdDecision threshold.

Definition at line 2800 of file testing_analysis.cpp.

◆ calculate_inputs_errors_cross_correlation()

Vector< Vector< double > > calculate_inputs_errors_cross_correlation ( const size_t &  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.

Parameters
maximum_lags_numberNumber of lags for which cross-correlation is calculated.

Definition at line 3045 of file testing_analysis.cpp.

◆ calculate_lift_chart()

Matrix< double > calculate_lift_chart ( const Matrix< double > &  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.

Parameters
cumulative_gainA cumulative gain chart.

Definition at line 2370 of file testing_analysis.cpp.

◆ calculate_maximal_errors()

Vector< Vector< size_t > > calculate_maximal_errors ( const size_t &  instances_number = 10) const

Returns a vector with the indices of the instances which have the greatest error.

Parameters
instances_numberNumber of maximal indices to be computed.

Definition at line 731 of file testing_analysis.cpp.

◆ calculate_maximum_gain()

Vector< double > calculate_maximum_gain ( const Matrix< double > &  positive_cumulative_gain,
const Matrix< double > &  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 instances ratio for which it occurs.

Parameters
positive_cumulative_gainCumulative gain fo the positive instances.
negative_cumulative_gainCumulative gain fo the negative instances.

Definition at line 2474 of file testing_analysis.cpp.

◆ calculate_multiple_classification_rates()

Matrix< Vector< size_t > > calculate_multiple_classification_rates ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Vector< size_t > &  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 2942 of file testing_analysis.cpp.

◆ calculate_multiple_classification_testing_errors()

Vector< double > 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:

  • Sum squared error.
  • Mean squared error.
  • Root mean squared error.
  • Normalized squared error.
  • Cross-entropy error.

Definition at line 1218 of file testing_analysis.cpp.

◆ calculate_negative_cumulative_gain()

Matrix< double > calculate_negative_cumulative_gain ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns a matrix with the values of a cumulative gain chart for the negative instances. The number of columns is two, the number of rows is 20.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 2237 of file testing_analysis.cpp.

◆ calculate_optimal_threshold() [1/2]

double calculate_optimal_threshold ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns the point of optimal classification accuracy, which is the nearest ROC curve point to the upper left corner(0,1).

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1965 of file testing_analysis.cpp.

◆ calculate_optimal_threshold() [2/2]

double calculate_optimal_threshold ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Matrix< double > &  roc_curve 
) const

Returns the point of optimal classification accuracy, which is the nearest ROC curve point to the upper left corner(0,1).

Parameters
targetsTesting target data.
outputsTesting output data.
roc_curveROC curve.

Definition at line 2032 of file testing_analysis.cpp.

◆ calculate_output_histogram()

Vector< Histogram > calculate_output_histogram ( const Tensor< double > &  outputs,
const size_t &  bins_number = 10 
) const

Returns the histogram of the outputs.

Parameters
outputsTesting output data.
bins_numberNumber of bins of the histogram.

Definition at line 2671 of file testing_analysis.cpp.

◆ calculate_percentage_error_data()

Vector< Vector< double > > calculate_percentage_error_data ( ) const

Calculates the percentege errors between the outputs from a neural network and the testing instances in a data set. The number of rows in each matrix is the number of testing instances in the data set.

Definition at line 491 of file testing_analysis.cpp.

◆ calculate_positives_negatives_rate()

Vector< size_t > calculate_positives_negatives_rate ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns a vector containing the number of total positives and the number of total negatives instances of a data set. The size of the vector is two and consists of:

  • Total positives.
  • Total negatives.

Definition at line 1516 of file testing_analysis.cpp.

◆ calculate_roc_curve()

Matrix< double > calculate_roc_curve ( const Tensor< double > &  targets,
const Tensor< double > &  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.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1712 of file testing_analysis.cpp.

◆ calculate_testing_cross_entropy_error()

double calculate_testing_cross_entropy_error ( const Tensor< double > &  targets,
const Tensor< double > &  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.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1299 of file testing_analysis.cpp.

◆ calculate_testing_errors()

Vector< double > 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:

  • Sum squared error.
  • Mean squared error.
  • Root mean squared error.
  • Normalized squared error.

Definition at line 1086 of file testing_analysis.cpp.

◆ calculate_testing_normalized_squared_error()

double calculate_testing_normalized_squared_error ( const Tensor< double > &  targets,
const Tensor< double > &  outputs 
) const

Returns the normalized squared error between the targets and the outputs of the neural network.

Parameters
targetsTesting target data.
outputsTesting output data.

Definition at line 1271 of file testing_analysis.cpp.

◆ calculate_testing_weighted_squared_error()

double calculate_testing_weighted_squared_error ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Vector< double > &  weights = Vector<double>() 
) 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.

Parameters
targetsTesting target data.
outputsTesting output data.
weightsWeights of the postitives and negatives to evaluate.

Definition at line 1342 of file testing_analysis.cpp.

◆ calculate_true_negative_instances()

Vector< size_t > calculate_true_negative_instances ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Vector< size_t > &  testing_indices,
const double &  decision_threshold 
) const

Returns a vector with the indices of the true negative instances. The size of the vector is the number of true negative instances.

Parameters
targetsTesting target data.
outputsTestinga output data.
testing_indicesIndices of the testing data
decision_thresholdDecision threshold.

Definition at line 2852 of file testing_analysis.cpp.

◆ calculate_true_positive_instances()

Vector< size_t > calculate_true_positive_instances ( const Tensor< double > &  targets,
const Tensor< double > &  outputs,
const Vector< size_t > &  testing_indices,
const double &  decision_threshold 
) const

Returns a vector with the indices of the true positive instances. The size of the vector is the number of true positive instances.

Parameters
targetsTesting target data.
outputsTesting outputs.
testing_indicesIndices of testing data.
decision_thresholdDecision threshold.

Definition at line 2774 of file testing_analysis.cpp.

◆ calculate_Wilcoxon_parameter()

double calculate_Wilcoxon_parameter ( const double &  x,
const double &  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.

Parameters
xTarget data value.
yTarget data value.

Definition at line 1688 of file testing_analysis.cpp.

◆ check()

void check ( ) const

Checks that:

  • The neural network pointer is not nullptr.
  • The data set pointer is not nullptr.

Definition at line 216 of file testing_analysis.cpp.

◆ from_XML()

void from_XML ( const tinyxml2::XMLDocument document)
virtual

Deserializes a TinyXML document into this testing analysis object.

Parameters
documentXML document containing the member data.

Definition at line 3575 of file testing_analysis.cpp.

◆ get_display()

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 164 of file testing_analysis.cpp.

◆ linear_regression()

Vector< RegressionResults > linear_regression ( ) 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 247 of file testing_analysis.cpp.

◆ load()

void load ( const string &  file_name)

Loads from a XML file the members for this testing analysis object.

Parameters
file_nameName of testing analysis XML file.

Definition at line 3626 of file testing_analysis.cpp.

◆ perform_cumulative_gain_analysis()

Matrix< double > perform_cumulative_gain_analysis ( ) const

Performs a cumulative gain analysis. Returns a matrix with the values of a cumulative gain chart.

Definition at line 2095 of file testing_analysis.cpp.

◆ perform_Kolmogorov_Smirnov_analysis()

TestingAnalysis::KolmogorovSmirnovResults perform_Kolmogorov_Smirnov_analysis ( ) const

Performs a Kolmogorov-Smirnov analysis, which consists of the cumulative gain for the positive instances and the cumulative gain for the negative instances. It returns a Kolmogorov-Smirnov results structure, which consists of:

  • Positive cumulative gain
  • Negative cumulative gain
  • Maximum gain

Definition at line 2400 of file testing_analysis.cpp.

◆ perform_lift_chart_analysis()

Matrix< double > perform_lift_chart_analysis ( ) const

Performs a lift chart analysis. Returns a matrix with the values of a lift chart.

Definition at line 2304 of file testing_analysis.cpp.

◆ perform_linear_regression_analysis()

Vector< TestingAnalysis::LinearRegressionAnalysis > 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:

  • Linear regression parameters.
  • Scaled target and output data.

Definition at line 335 of file testing_analysis.cpp.

◆ perform_roc_analysis()

TestingAnalysis::RocAnalysisResults perform_roc_analysis ( ) const

Performs a ROC curve analysis. It returns a ROC curve analysis results structure, which consists of:

  • ROC curve
  • Area under the ROC curve
  • Optimal threshold

Definition at line 1614 of file testing_analysis.cpp.

◆ save()

void save ( const string &  file_name) const

Saves to a XML file the members of this testing analysis object.

Parameters
file_nameName of testing analysis XML file.

Definition at line 3613 of file testing_analysis.cpp.

◆ set_data_set_pointer()

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.

Parameters
new_data_set_pointerPointer to a data set object.

Definition at line 193 of file testing_analysis.cpp.

◆ set_default()

void set_default ( )

Sets some default values to the testing analysis object:

  • Display: True.

Definition at line 175 of file testing_analysis.cpp.

◆ set_display()

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.

Parameters
new_displayDisplay value.

Definition at line 204 of file testing_analysis.cpp.

◆ set_neural_network_pointer()

void set_neural_network_pointer ( NeuralNetwork new_neural_network_pointer)

Sets a new neural network object to be tested.

Parameters
new_neural_network_pointerPointer to a neural network object.

Definition at line 184 of file testing_analysis.cpp.

◆ to_XML()

tinyxml2::XMLDocument * to_XML ( ) const
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 3521 of file testing_analysis.cpp.

◆ write_XML()

void write_XML ( tinyxml2::XMLPrinter file_stream) const
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 3551 of file testing_analysis.cpp.


The documentation for this class was generated from the following files: