9#ifndef TESTINGANALYSIS_H
10#define TESTINGANALYSIS_H
26#include "correlations.h"
28#include "neural_network.h"
64 type intercept = type(0);
68 Tensor<type, 1> targets;
69 Tensor<type, 1> outputs;
73 void save(
const string&)
const
79 cout <<
"Linear regression analysis" << endl;
81 cout <<
"Intercept: " << intercept << endl;
82 cout <<
"Slope: " << slope << endl;
165 void set_threads_number(
const int&);
176 Tensor<Descriptives, 1> calculate_absolute_errors_descriptives()
const;
177 Tensor<Descriptives, 1> calculate_absolute_errors_descriptives(
const Tensor<type, 2>&,
const Tensor<type, 2>&)
const;
179 Tensor<Descriptives, 1> calculate_percentage_errors_descriptives()
const;
180 Tensor<Descriptives, 1> calculate_percentage_errors_descriptives(
const Tensor<type, 2>&,
const Tensor<type, 2>&)
const;
183 void print_error_data_descriptives()
const;
190 Tensor<type, 2> calculate_binary_classification_errors()
const;
191 Tensor<type, 2> calculate_multiple_classification_errors()
const;
193 Tensor<type, 1> calculate_training_errors()
const;
194 Tensor<type, 1> calculate_binary_classification_training_errors()
const;
195 Tensor<type, 1> calculate_multiple_classification_training_errors()
const;
197 Tensor<type, 1> calculate_selection_errors()
const;
198 Tensor<type, 1> calculate_binary_classification_selection_errors()
const;
199 Tensor<type, 1> calculate_multiple_classification_selection_errors()
const;
208 type calculate_Minkowski_error(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const type = type(1.5))
const;
213 Tensor<Correlation, 1>
linear_correlation(
const Tensor<type, 2>&,
const Tensor<type, 2>&)
const;
215 void print_linear_regression_correlations()
const;
218 void print_linear_regression_analysis()
const;
224 void print_binary_classification_tests()
const;
235 Tensor<Index, 2>
calculate_confusion(
const Tensor<type, 2>&,
const Tensor<type, 2>&)
const;
285 Tensor<type, 1> calculate_multiple_classification_tests()
const;
286 void save_confusion(
const string&)
const;
287 void save_multiple_classification_tests(
const string&)
const;
295 Tensor<string, 2> calculate_well_classified_samples(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&);
297 Tensor<string, 2> calculate_misclassified_samples(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&);
299 void save_well_classified_samples(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&,
const string&);
301 void save_misclassified_samples(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&,
const string&);
303 void save_well_classified_samples_statistics(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&,
const string&);
305 void save_misclassified_samples_statistics(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&,
const string&);
307 void save_well_classified_samples_probability_histogram(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&,
const string&);
309 void save_well_classified_samples_probability_histogram(
const Tensor<string, 2>&,
const string&);
311 void save_misclassified_samples_probability_histogram(
const Tensor<type, 2>&,
const Tensor<type, 2>&,
const Tensor<string, 1>&,
const string&);
313 void save_misclassified_samples_probability_histogram(
const Tensor<string, 2>&,
const string&);
329 void save(
const string&)
const;
330 void load(
const string&);
332 bool contains(
const Tensor<type, 1>&,
const type&)
const;
333 Tensor<type, 2> delete_row(
const Tensor<type, 2>&,
const Index&)
const;
338 NonBlockingThreadPool* non_blocking_thread_pool =
nullptr;
339 ThreadPoolDevice* thread_pool_device =
nullptr;
353 const Eigen::array<IndexPair<Index>, 2> SSE = {IndexPair<Index>(0, 0), IndexPair<Index>(1, 1)};
This class represents the concept of data set for data modelling problems, such as approximation,...
This class contains tools for testing neural networks in different learning tasks.
Tensor< type, 2 > calculate_roc_curve(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
Tensor< type, 2 > perform_calibration_plot_analysis() const
Performs a calibration plot analysis.
KolmogorovSmirnovResults perform_Kolmogorov_Smirnov_analysis() const
DataSet * data_set_pointer
Pointer to a data set object.
Tensor< type, 2 > calculate_lift_chart(const Tensor< type, 2 > &) const
NeuralNetwork * neural_network_pointer
Pointer to the neural network object to be tested.
type calculate_optimal_threshold(const Tensor< type, 2 > &, const Tensor< type, 2 > &) 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.
Tensor< type, 2 > calculate_percentage_error_data() const
void set_data_set_pointer(DataSet *)
Tensor< type, 2 > calculate_errors() const
const bool & get_display() const
Tensor< type, 1 > calculate_multiple_classification_testing_errors() 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_positive_samples(const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const
type calculate_weighted_squared_error(const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< type, 1 > &=Tensor< type, 1 >()) const
type calculate_cross_entropy_error(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
virtual void from_XML(const tinyxml2::XMLDocument &)
void load(const string &)
Tensor< type, 3 > calculate_error_data() const
Tensor< Index, 1 > calculate_positives_negatives_rate(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
Tensor< Index, 1 > calculate_false_positive_samples(const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const
bool display
Display messages to screen.
Tensor< type, 2 > perform_cumulative_gain_analysis() const
Tensor< Index, 2 > calculate_confusion_multiple_classification(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
Tensor< type, 2 > perform_lift_chart_analysis() const
type calculate_Wilcoxon_parameter(const type &, const type &) const
type calculate_area_under_curve_confidence_limit(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
Tensor< type, 2 > calculate_calibration_plot(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
type calculate_area_under_curve(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
RocAnalysisResults perform_roc_analysis() const
Tensor< Index, 2 > calculate_confusion_binary_classification(const Tensor< type, 2 > &, const Tensor< type, 2 > &, const type &) const
Tensor< Tensor< Index, 1 >, 1 > calculate_maximal_errors(const Index &=10) const
void save(const string &) const
Tensor< Tensor< type, 1 >, 1 > calculate_inputs_errors_cross_correlation(const Index &=10) const
NeuralNetwork * get_neural_network_pointer() const
Returns a pointer to the neural network object which is to be tested.
type calculate_normalized_squared_error(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
Tensor< Index, 2 > calculate_confusion() const
Tensor< type, 2 > calculate_negative_cumulative_gain(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
void set_neural_network_pointer(NeuralNetwork *)
Tensor< Tensor< type, 1 >, 1 > calculate_error_autocorrelation(const Index &=10) const
Tensor< LinearRegressionAnalysis, 1 > perform_linear_regression_analysis() const
type calculate_logloss() const
Returns the logloss for a binary classification problem.
Tensor< type, 1 > calculate_maximum_gain(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
Tensor< type, 1 > calculate_binary_classification_tests() const
void print() const
Prints to the standard output the string representation of this testing analysis object.
Tensor< Histogram, 1 > calculate_error_data_histograms(const Index &=10) const
void set_display(const bool &)
virtual void write_XML(tinyxml2::XMLPrinter &) const
Tensor< type, 1 > calculate_binary_classification_testing_errors() const
Tensor< type, 1 > calculate_testing_errors() const
Tensor< Index, 1 > calculate_true_negative_samples(const Tensor< type, 2 > &, const Tensor< type, 2 > &, const Tensor< Index, 1 > &, const type &) const
Tensor< Correlation, 1 > linear_correlation() const
BinaryClassifcationRates calculate_binary_classification_rates() const
Tensor< type, 2 > calculate_cumulative_gain(const Tensor< type, 2 > &, const Tensor< type, 2 > &) const
DataSet * get_data_set_pointer() const
Returns a pointer to the data set object on which the neural network is tested.
virtual ~TestingAnalysis()
Tensor< Histogram, 1 > calculate_output_histogram(const Tensor< type, 2 > &, const Index &=10) const
Tensor< Tensor< Descriptives, 1 >, 1 > calculate_error_data_descriptives() const
Structure with the binary classification rates.
Tensor< Index, 1 > true_negatives_indices
Vector with the indices of the samples which are true negative.
Tensor< Index, 1 > true_positives_indices
Vector with the indices of the samples which are true positive.
Tensor< Index, 1 > false_positives_indices
Vector with the indices of the samples which are false positive.
Tensor< Index, 1 > false_negatives_indices
Vector with the indices of the samples which are false negative.
Structure with the results from Kolmogorov-Smirnov analysis.
Tensor< type, 2 > positive_cumulative_gain
Matrix containing the data of a positive cumulative gain.
Tensor< type, 1 > maximum_gain
Maximum gain of the cumulative gain analysis.
Tensor< type, 2 > negative_cumulative_gain
Matrix containing the data of a negative cumulative gain.
Structure with the results from a linear regression analysis.
void save(const string &) const
type correlation
Target data from data set and output data from neural network.
Structure with the results from a roc curve analysis.
type confidence_limit
Confidence limit.
type optimal_threshold
Optimal threshold of a ROC curve.
Tensor< type, 2 > roc_curve
Matrix containing the data of a ROC curve.
type area_under_curve
Area under a ROC curve.