OpenNN
Open-source neural networks library
Loading...
Searching...
No Matches
opennn::TestingAnalysis Class Reference

Performs post-training analysis of a neural network: errors, confusion matrices, ROC, gain charts, etc. More...

#include <testing_analysis.h>

Classes

struct  BinaryClassificationRates
 Sample indices split into the four cells of a binary classification confusion matrix. More...
 
struct  GoodnessOfFitAnalysis
 Coefficient of determination and the matching target/output series for a single output variable. More...
 
struct  KolmogorovSmirnovResults
 Results of a Kolmogorov-Smirnov analysis: cumulative gains and maximum gain. More...
 
struct  RocAnalysis
 Results of a ROC analysis: ROC curve, area under it and optimal threshold. More...
 

Public Member Functions

 TestingAnalysis (NeuralNetwork *=nullptr, Dataset *=nullptr)
 Constructs the analyser bound to an optional neural network and dataset.
 
const NeuralNetworkget_neural_network () const
 
const Datasetget_dataset () const
 
void set_neural_network (NeuralNetwork *new_neural_network)
 
void set_dataset (Dataset *new_dataset)
 
void set_batch_size (Index new_batch_size)
 
Index get_batch_size () const
 
void check () const
 Verifies that the neural network and dataset are consistent for testing analysis.
 
MatrixR calculate_error () const
 Computes the overall error matrix between targets and outputs on the testing samples.
 
Tensor3 calculate_error_data () const
 Computes the per-sample, per-variable error tensor on the testing samples.
 
MatrixR calculate_percentage_error_data () const
 Computes the per-sample percentage error matrix on the testing samples.
 
vector< Descriptivescalculate_absolute_errors_descriptives () const
 Computes descriptive statistics of the absolute errors over the testing samples.
 
vector< Descriptivescalculate_absolute_errors_descriptives (const MatrixR &, const MatrixR &) const
 Computes descriptive statistics of the absolute errors between the supplied targets and outputs.
 
vector< Descriptivescalculate_percentage_errors_descriptives () const
 Computes descriptive statistics of the percentage errors over the testing samples.
 
vector< Descriptivescalculate_percentage_errors_descriptives (const MatrixR &, const MatrixR &) const
 Computes descriptive statistics of the percentage errors between the supplied targets and outputs.
 
vector< vector< Descriptives > > calculate_error_data_descriptives () const
 Computes descriptive statistics of the per-sample error data on the testing samples.
 
void print_error_data_descriptives () const
 Prints the error-data descriptive statistics to stdout.
 
vector< Histogramcalculate_error_data_histograms (const Index=10) const
 Builds histograms of the per-variable error data on the testing samples.
 
Tensor< VectorI, 1 > calculate_maximal_errors (const Index=10) const
 Returns the indices of the samples with the largest errors per output variable.
 
MatrixR calculate_errors () const
 Computes the per-variable error metrics on the testing samples.
 
VectorR calculate_errors (const MatrixR &, const MatrixR &) const
 Computes the error metrics for the supplied targets and outputs.
 
VectorR calculate_errors (const string &) const
 Computes the error metrics for the sample subset with the given role name.
 
MatrixR calculate_binary_classification_errors () const
 Computes binary classification error metrics on the testing samples.
 
VectorR calculate_binary_classification_errors (const string &) const
 Computes binary classification error metrics on the samples with the given role name.
 
MatrixR calculate_multiple_classification_errors () const
 Computes multi-class classification error metrics on the testing samples.
 
VectorR calculate_multiple_classification_errors (const string &) const
 Computes multi-class classification error metrics on the samples with the given role name.
 
float calculate_masked_accuracy (const Tensor3 &, const MatrixR &) const
 Computes accuracy when a masking matrix indicates which tokens to consider (e.g. for language models).
 
float calculate_determination (const VectorR &, const VectorR &) const
 Computes the coefficient of determination R^2 between the supplied target and output series.
 
Tensor< Correlation, 1 > linear_correlation (const MatrixR &, const MatrixR &) const
 Computes the linear correlation between each target/output column pair.
 
void print_linear_correlations () const
 Prints the linear correlations between targets and outputs to stdout.
 
Tensor< GoodnessOfFitAnalysis, 1 > perform_goodness_of_fit_analysis () const
 Performs goodness-of-fit analysis for each output variable.
 
void print_goodness_of_fit_analysis () const
 Prints the goodness-of-fit analysis to stdout.
 
VectorR calculate_binary_classification_tests (const float=0.50) const
 Computes the standard binary classification metrics for the given decision threshold.
 
void print_binary_classification_tests () const
 Prints binary classification metrics to stdout.
 
vector< MatrixIcalculate_multilabel_confusion (const float) const
 Computes per-label binary confusion matrices for multi-label classification.
 
MatrixI calculate_confusion (const MatrixR &, const MatrixR &, float=0.50) const
 Computes the confusion matrix from the supplied targets and outputs.
 
MatrixI calculate_confusion (const float=0.50) const
 Computes the confusion matrix on the testing samples for the given decision threshold.
 
VectorI calculate_positives_negatives_rate (const MatrixR &, const MatrixR &) const
 Counts positives and negatives in targets and outputs (returns TP, FP, FN, TN).
 
RocAnalysis perform_roc_analysis () const
 Performs ROC analysis on the testing samples.
 
MatrixR calculate_roc_curve (const MatrixR &, const MatrixR &) const
 Computes the ROC curve from the supplied targets and outputs.
 
float calculate_area_under_curve (const MatrixR &) const
 Computes the area under the supplied ROC curve.
 
float calculate_area_under_curve_confidence_limit (const MatrixR &, const MatrixR &) const
 Computes the confidence limit of the area under the ROC curve.
 
float calculate_optimal_threshold (const MatrixR &) const
 Computes the decision threshold that maximizes the ROC criterion.
 
MatrixR perform_cumulative_gain_analysis () const
 Performs a cumulative gain analysis on the testing samples.
 
MatrixR calculate_cumulative_gain (const MatrixR &, const MatrixR &) const
 Computes the positive cumulative gain curve from the supplied targets and outputs.
 
MatrixR calculate_negative_cumulative_gain (const MatrixR &, const MatrixR &) const
 Computes the negative cumulative gain curve from the supplied targets and outputs.
 
MatrixR perform_lift_chart_analysis () const
 Performs a lift chart analysis on the testing samples.
 
MatrixR calculate_lift_chart (const MatrixR &) const
 Computes the lift chart from the supplied cumulative gain matrix.
 
KolmogorovSmirnovResults perform_Kolmogorov_Smirnov_analysis () const
 Performs a Kolmogorov-Smirnov analysis on the testing samples.
 
VectorR calculate_maximum_gain (const MatrixR &, const MatrixR &) const
 Computes the maximum gain between positive and negative cumulative gain curves.
 
vector< Histogramcalculate_output_histogram (const MatrixR &, Index=10) const
 Builds histograms of the supplied outputs for the given number of bins.
 
BinaryClassificationRates calculate_binary_classification_rates (const float=0.50) const
 Returns sample indices in the four cells of the binary confusion matrix for the given threshold.
 
vector< Index > calculate_true_positive_samples (const MatrixR &, const MatrixR &, const vector< Index > &, float) const
 Returns the indices of true positive samples given targets, outputs and a candidate index list.
 
vector< Index > calculate_false_positive_samples (const MatrixR &, const MatrixR &, const vector< Index > &, float) const
 Returns the indices of false positive samples given targets, outputs and a candidate index list.
 
vector< Index > calculate_false_negative_samples (const MatrixR &, const MatrixR &, const vector< Index > &, float) const
 Returns the indices of false negative samples given targets, outputs and a candidate index list.
 
vector< Index > calculate_true_negative_samples (const MatrixR &, const MatrixR &, const vector< Index > &, float) const
 Returns the indices of true negative samples given targets, outputs and a candidate index list.
 
VectorR calculate_multiple_classification_precision () const
 Computes the per-class precision for multi-class classification.
 
MatrixR calculate_multiple_classification_tests () const
 Computes the standard multi-class classification metrics.
 
Tensor< VectorI, 2 > calculate_multiple_classification_rates () const
 Returns the per-cell sample indices of the multi-class confusion matrix for the testing samples.
 
Tensor< VectorI, 2 > calculate_multiple_classification_rates (const MatrixR &, const MatrixR &, const vector< Index > &) const
 Returns the per-cell sample indices of the multi-class confusion matrix for the supplied data.
 
Tensor< string, 2 > calculate_well_classified_samples (const MatrixR &, const MatrixR &, const vector< string > &) const
 Returns the well-classified samples annotated with their target and output labels.
 
Tensor< string, 2 > calculate_misclassified_samples (const MatrixR &, const MatrixR &, const vector< string > &) const
 Returns the misclassified samples annotated with their target and output labels.
 
void save_confusion (const filesystem::path &) const
 Saves the confusion matrix of the testing samples to disk.
 
void save_multiple_classification_tests (const filesystem::path &) const
 Saves the multi-class classification metrics of the testing samples to disk.
 
void save_well_classified_samples (const MatrixR &, const MatrixR &, const vector< string > &, const filesystem::path &) const
 Saves the well-classified samples annotated table to disk.
 
void save_misclassified_samples (const MatrixR &, const MatrixR &, const vector< string > &, const filesystem::path &) const
 Saves the misclassified samples annotated table to disk.
 
void save_well_classified_samples_statistics (const MatrixR &, const MatrixR &, const vector< string > &, const filesystem::path &) const
 Saves per-class statistics of the well-classified samples to disk.
 
void save_misclassified_samples_statistics (const MatrixR &, const MatrixR &, const vector< string > &, const filesystem::path &) const
 Saves per-class statistics of the misclassified samples to disk.
 
vector< VectorRcalculate_error_autocorrelation (const Index=10) const
 Computes the autocorrelation of the residual errors up to the given lag.
 
vector< VectorRcalculate_inputs_errors_cross_correlation (const Index=10) const
 Computes the cross-correlation between input variables and residual errors up to the given lag.
 
pair< float, float > test_transformer () const
 Computes loss and accuracy of a transformer model on the testing samples.
 
string test_transformer (const vector< string > &context_string, bool imported_vocabulary) const
 Generates a transformer prediction string from a context.
 
void from_JSON (const JsonDocument &)
 Loads the testing analysis configuration from a JSON document.
 
void to_JSON (JsonWriter &) const
 Writes the testing analysis configuration to a JSON writer.
 
void save (const filesystem::path &) const
 Saves the testing analysis configuration to disk.
 
void load (const filesystem::path &)
 Loads the testing analysis configuration from disk.
 

Detailed Description

Performs post-training analysis of a neural network: errors, confusion matrices, ROC, gain charts, etc.

Constructor & Destructor Documentation

◆ TestingAnalysis()

opennn::TestingAnalysis::TestingAnalysis ( NeuralNetwork * = nullptr,
Dataset * = nullptr )

Constructs the analyser bound to an optional neural network and dataset.

Member Function Documentation

◆ calculate_absolute_errors_descriptives() [1/2]

vector< Descriptives > opennn::TestingAnalysis::calculate_absolute_errors_descriptives ( ) const

Computes descriptive statistics of the absolute errors over the testing samples.

◆ calculate_absolute_errors_descriptives() [2/2]

vector< Descriptives > opennn::TestingAnalysis::calculate_absolute_errors_descriptives ( const MatrixR & ,
const MatrixR &  ) const

Computes descriptive statistics of the absolute errors between the supplied targets and outputs.

◆ calculate_area_under_curve()

float opennn::TestingAnalysis::calculate_area_under_curve ( const MatrixR & ) const

Computes the area under the supplied ROC curve.

◆ calculate_area_under_curve_confidence_limit()

float opennn::TestingAnalysis::calculate_area_under_curve_confidence_limit ( const MatrixR & ,
const MatrixR &  ) const

Computes the confidence limit of the area under the ROC curve.

◆ calculate_binary_classification_errors() [1/2]

MatrixR opennn::TestingAnalysis::calculate_binary_classification_errors ( ) const

Computes binary classification error metrics on the testing samples.

◆ calculate_binary_classification_errors() [2/2]

VectorR opennn::TestingAnalysis::calculate_binary_classification_errors ( const string & ) const

Computes binary classification error metrics on the samples with the given role name.

◆ calculate_binary_classification_rates()

BinaryClassificationRates opennn::TestingAnalysis::calculate_binary_classification_rates ( const float = 0.50) const

Returns sample indices in the four cells of the binary confusion matrix for the given threshold.

◆ calculate_binary_classification_tests()

VectorR opennn::TestingAnalysis::calculate_binary_classification_tests ( const float = 0.50) const

Computes the standard binary classification metrics for the given decision threshold.

◆ calculate_confusion() [1/2]

MatrixI opennn::TestingAnalysis::calculate_confusion ( const float = 0.50) const

Computes the confusion matrix on the testing samples for the given decision threshold.

◆ calculate_confusion() [2/2]

MatrixI opennn::TestingAnalysis::calculate_confusion ( const MatrixR & ,
const MatrixR & ,
float = 0.50 ) const

Computes the confusion matrix from the supplied targets and outputs.

◆ calculate_cumulative_gain()

MatrixR opennn::TestingAnalysis::calculate_cumulative_gain ( const MatrixR & ,
const MatrixR &  ) const

Computes the positive cumulative gain curve from the supplied targets and outputs.

◆ calculate_determination()

float opennn::TestingAnalysis::calculate_determination ( const VectorR & ,
const VectorR &  ) const

Computes the coefficient of determination R^2 between the supplied target and output series.

◆ calculate_error()

MatrixR opennn::TestingAnalysis::calculate_error ( ) const

Computes the overall error matrix between targets and outputs on the testing samples.

◆ calculate_error_autocorrelation()

vector< VectorR > opennn::TestingAnalysis::calculate_error_autocorrelation ( const Index = 10) const

Computes the autocorrelation of the residual errors up to the given lag.

◆ calculate_error_data()

Tensor3 opennn::TestingAnalysis::calculate_error_data ( ) const

Computes the per-sample, per-variable error tensor on the testing samples.

◆ calculate_error_data_descriptives()

vector< vector< Descriptives > > opennn::TestingAnalysis::calculate_error_data_descriptives ( ) const

Computes descriptive statistics of the per-sample error data on the testing samples.

◆ calculate_error_data_histograms()

vector< Histogram > opennn::TestingAnalysis::calculate_error_data_histograms ( const Index = 10) const

Builds histograms of the per-variable error data on the testing samples.

◆ calculate_errors() [1/3]

MatrixR opennn::TestingAnalysis::calculate_errors ( ) const

Computes the per-variable error metrics on the testing samples.

◆ calculate_errors() [2/3]

VectorR opennn::TestingAnalysis::calculate_errors ( const MatrixR & ,
const MatrixR &  ) const

Computes the error metrics for the supplied targets and outputs.

◆ calculate_errors() [3/3]

VectorR opennn::TestingAnalysis::calculate_errors ( const string & ) const

Computes the error metrics for the sample subset with the given role name.

◆ calculate_false_negative_samples()

vector< Index > opennn::TestingAnalysis::calculate_false_negative_samples ( const MatrixR & ,
const MatrixR & ,
const vector< Index > & ,
float  ) const

Returns the indices of false negative samples given targets, outputs and a candidate index list.

◆ calculate_false_positive_samples()

vector< Index > opennn::TestingAnalysis::calculate_false_positive_samples ( const MatrixR & ,
const MatrixR & ,
const vector< Index > & ,
float  ) const

Returns the indices of false positive samples given targets, outputs and a candidate index list.

◆ calculate_inputs_errors_cross_correlation()

vector< VectorR > opennn::TestingAnalysis::calculate_inputs_errors_cross_correlation ( const Index = 10) const

Computes the cross-correlation between input variables and residual errors up to the given lag.

◆ calculate_lift_chart()

MatrixR opennn::TestingAnalysis::calculate_lift_chart ( const MatrixR & ) const

Computes the lift chart from the supplied cumulative gain matrix.

◆ calculate_masked_accuracy()

float opennn::TestingAnalysis::calculate_masked_accuracy ( const Tensor3 & ,
const MatrixR &  ) const

Computes accuracy when a masking matrix indicates which tokens to consider (e.g. for language models).

◆ calculate_maximal_errors()

Tensor< VectorI, 1 > opennn::TestingAnalysis::calculate_maximal_errors ( const Index = 10) const

Returns the indices of the samples with the largest errors per output variable.

◆ calculate_maximum_gain()

VectorR opennn::TestingAnalysis::calculate_maximum_gain ( const MatrixR & ,
const MatrixR &  ) const

Computes the maximum gain between positive and negative cumulative gain curves.

◆ calculate_misclassified_samples()

Tensor< string, 2 > opennn::TestingAnalysis::calculate_misclassified_samples ( const MatrixR & ,
const MatrixR & ,
const vector< string > &  ) const

Returns the misclassified samples annotated with their target and output labels.

◆ calculate_multilabel_confusion()

vector< MatrixI > opennn::TestingAnalysis::calculate_multilabel_confusion ( const float ) const

Computes per-label binary confusion matrices for multi-label classification.

◆ calculate_multiple_classification_errors() [1/2]

MatrixR opennn::TestingAnalysis::calculate_multiple_classification_errors ( ) const

Computes multi-class classification error metrics on the testing samples.

◆ calculate_multiple_classification_errors() [2/2]

VectorR opennn::TestingAnalysis::calculate_multiple_classification_errors ( const string & ) const

Computes multi-class classification error metrics on the samples with the given role name.

◆ calculate_multiple_classification_precision()

VectorR opennn::TestingAnalysis::calculate_multiple_classification_precision ( ) const

Computes the per-class precision for multi-class classification.

◆ calculate_multiple_classification_rates() [1/2]

Tensor< VectorI, 2 > opennn::TestingAnalysis::calculate_multiple_classification_rates ( ) const

Returns the per-cell sample indices of the multi-class confusion matrix for the testing samples.

◆ calculate_multiple_classification_rates() [2/2]

Tensor< VectorI, 2 > opennn::TestingAnalysis::calculate_multiple_classification_rates ( const MatrixR & ,
const MatrixR & ,
const vector< Index > &  ) const

Returns the per-cell sample indices of the multi-class confusion matrix for the supplied data.

◆ calculate_multiple_classification_tests()

MatrixR opennn::TestingAnalysis::calculate_multiple_classification_tests ( ) const

Computes the standard multi-class classification metrics.

◆ calculate_negative_cumulative_gain()

MatrixR opennn::TestingAnalysis::calculate_negative_cumulative_gain ( const MatrixR & ,
const MatrixR &  ) const

Computes the negative cumulative gain curve from the supplied targets and outputs.

◆ calculate_optimal_threshold()

float opennn::TestingAnalysis::calculate_optimal_threshold ( const MatrixR & ) const

Computes the decision threshold that maximizes the ROC criterion.

◆ calculate_output_histogram()

vector< Histogram > opennn::TestingAnalysis::calculate_output_histogram ( const MatrixR & ,
Index = 10 ) const

Builds histograms of the supplied outputs for the given number of bins.

◆ calculate_percentage_error_data()

MatrixR opennn::TestingAnalysis::calculate_percentage_error_data ( ) const

Computes the per-sample percentage error matrix on the testing samples.

◆ calculate_percentage_errors_descriptives() [1/2]

vector< Descriptives > opennn::TestingAnalysis::calculate_percentage_errors_descriptives ( ) const

Computes descriptive statistics of the percentage errors over the testing samples.

◆ calculate_percentage_errors_descriptives() [2/2]

vector< Descriptives > opennn::TestingAnalysis::calculate_percentage_errors_descriptives ( const MatrixR & ,
const MatrixR &  ) const

Computes descriptive statistics of the percentage errors between the supplied targets and outputs.

◆ calculate_positives_negatives_rate()

VectorI opennn::TestingAnalysis::calculate_positives_negatives_rate ( const MatrixR & ,
const MatrixR &  ) const

Counts positives and negatives in targets and outputs (returns TP, FP, FN, TN).

◆ calculate_roc_curve()

MatrixR opennn::TestingAnalysis::calculate_roc_curve ( const MatrixR & ,
const MatrixR &  ) const

Computes the ROC curve from the supplied targets and outputs.

◆ calculate_true_negative_samples()

vector< Index > opennn::TestingAnalysis::calculate_true_negative_samples ( const MatrixR & ,
const MatrixR & ,
const vector< Index > & ,
float  ) const

Returns the indices of true negative samples given targets, outputs and a candidate index list.

◆ calculate_true_positive_samples()

vector< Index > opennn::TestingAnalysis::calculate_true_positive_samples ( const MatrixR & ,
const MatrixR & ,
const vector< Index > & ,
float  ) const

Returns the indices of true positive samples given targets, outputs and a candidate index list.

◆ calculate_well_classified_samples()

Tensor< string, 2 > opennn::TestingAnalysis::calculate_well_classified_samples ( const MatrixR & ,
const MatrixR & ,
const vector< string > &  ) const

Returns the well-classified samples annotated with their target and output labels.

◆ check()

void opennn::TestingAnalysis::check ( ) const

Verifies that the neural network and dataset are consistent for testing analysis.

◆ from_JSON()

void opennn::TestingAnalysis::from_JSON ( const JsonDocument & )

Loads the testing analysis configuration from a JSON document.

◆ get_batch_size()

Index opennn::TestingAnalysis::get_batch_size ( ) const
inline

◆ get_dataset()

const Dataset * opennn::TestingAnalysis::get_dataset ( ) const
inline

◆ get_neural_network()

const NeuralNetwork * opennn::TestingAnalysis::get_neural_network ( ) const
inline

◆ linear_correlation()

Tensor< Correlation, 1 > opennn::TestingAnalysis::linear_correlation ( const MatrixR & ,
const MatrixR &  ) const

Computes the linear correlation between each target/output column pair.

◆ load()

void opennn::TestingAnalysis::load ( const filesystem::path & )

Loads the testing analysis configuration from disk.

◆ perform_cumulative_gain_analysis()

MatrixR opennn::TestingAnalysis::perform_cumulative_gain_analysis ( ) const

Performs a cumulative gain analysis on the testing samples.

◆ perform_goodness_of_fit_analysis()

Tensor< GoodnessOfFitAnalysis, 1 > opennn::TestingAnalysis::perform_goodness_of_fit_analysis ( ) const

Performs goodness-of-fit analysis for each output variable.

◆ perform_Kolmogorov_Smirnov_analysis()

KolmogorovSmirnovResults opennn::TestingAnalysis::perform_Kolmogorov_Smirnov_analysis ( ) const

Performs a Kolmogorov-Smirnov analysis on the testing samples.

◆ perform_lift_chart_analysis()

MatrixR opennn::TestingAnalysis::perform_lift_chart_analysis ( ) const

Performs a lift chart analysis on the testing samples.

◆ perform_roc_analysis()

RocAnalysis opennn::TestingAnalysis::perform_roc_analysis ( ) const

Performs ROC analysis on the testing samples.

◆ print_binary_classification_tests()

void opennn::TestingAnalysis::print_binary_classification_tests ( ) const

Prints binary classification metrics to stdout.

◆ print_error_data_descriptives()

void opennn::TestingAnalysis::print_error_data_descriptives ( ) const

Prints the error-data descriptive statistics to stdout.

◆ print_goodness_of_fit_analysis()

void opennn::TestingAnalysis::print_goodness_of_fit_analysis ( ) const

Prints the goodness-of-fit analysis to stdout.

◆ print_linear_correlations()

void opennn::TestingAnalysis::print_linear_correlations ( ) const

Prints the linear correlations between targets and outputs to stdout.

◆ save()

void opennn::TestingAnalysis::save ( const filesystem::path & ) const

Saves the testing analysis configuration to disk.

◆ save_confusion()

void opennn::TestingAnalysis::save_confusion ( const filesystem::path & ) const

Saves the confusion matrix of the testing samples to disk.

◆ save_misclassified_samples()

void opennn::TestingAnalysis::save_misclassified_samples ( const MatrixR & ,
const MatrixR & ,
const vector< string > & ,
const filesystem::path &  ) const

Saves the misclassified samples annotated table to disk.

◆ save_misclassified_samples_statistics()

void opennn::TestingAnalysis::save_misclassified_samples_statistics ( const MatrixR & ,
const MatrixR & ,
const vector< string > & ,
const filesystem::path &  ) const

Saves per-class statistics of the misclassified samples to disk.

◆ save_multiple_classification_tests()

void opennn::TestingAnalysis::save_multiple_classification_tests ( const filesystem::path & ) const

Saves the multi-class classification metrics of the testing samples to disk.

◆ save_well_classified_samples()

void opennn::TestingAnalysis::save_well_classified_samples ( const MatrixR & ,
const MatrixR & ,
const vector< string > & ,
const filesystem::path &  ) const

Saves the well-classified samples annotated table to disk.

◆ save_well_classified_samples_statistics()

void opennn::TestingAnalysis::save_well_classified_samples_statistics ( const MatrixR & ,
const MatrixR & ,
const vector< string > & ,
const filesystem::path &  ) const

Saves per-class statistics of the well-classified samples to disk.

◆ set_batch_size()

void opennn::TestingAnalysis::set_batch_size ( Index new_batch_size)
inline

◆ set_dataset()

void opennn::TestingAnalysis::set_dataset ( Dataset * new_dataset)
inline

◆ set_neural_network()

void opennn::TestingAnalysis::set_neural_network ( NeuralNetwork * new_neural_network)
inline

◆ test_transformer() [1/2]

pair< float, float > opennn::TestingAnalysis::test_transformer ( ) const

Computes loss and accuracy of a transformer model on the testing samples.

◆ test_transformer() [2/2]

string opennn::TestingAnalysis::test_transformer ( const vector< string > & context_string,
bool imported_vocabulary ) const

Generates a transformer prediction string from a context.

Parameters
context_stringTokenized context for the model.
imported_vocabularyTrue if the vocabulary was imported from outside the dataset.

◆ to_JSON()

void opennn::TestingAnalysis::to_JSON ( JsonWriter & ) const

Writes the testing analysis configuration to a JSON writer.