a set of C++ library classes
for neural networks development



class ROC

It computes the ROC curves
This class computes Receiver Operating Characteristic (ROC) curves for learning machines having a threshold that separates positive from negative patterns.

Public Methods

[more] ROC ()
Default constructor
[more] ROC (char* filename)
Constructor.
[more] ROC (char* pred_file, char* target_file)
Constructor.
[more]void read_data (char* filename)
Load predicted and target data from a file.
[more]void read_data_2 (char* pred_file, char* target_file)
Load predicted and target data from two separated files.
[more]void do_conf_matrix (float thresh=0)
It builds a confusion matrix.
[more]ROCvalue* compute_ROC_value (float thresh)
It computes a ROCvalue.
[more]void compute_ROC_curve (int num_interval)
It computes a ROC curve
It computes a ROC curve, subdividing the output in a set of equidistant intervals.
[more]void print_ROC_curve (void) const
It prints a ROC curve
It prints a ROC curve on stdout, printing sensitivity and 1-specificity pairs
[more]void print_ROC_curve_all (void) const
It prints a ROC curve considering also precision values
It prints a ROC curve on stdout, printing sensitivity, specificity, 1-specificity and precision
[more]void print_predicted (void) const
It prints the predicted data on stdout.
[more]void print_target (void) const
It prints the target data on stdout.


Documentation

It computes the ROC curves
This class computes Receiver Operating Characteristic (ROC) curves for learning machines having a threshold that separates positive from negative patterns. It computes sensitivty, specificity and precision for different threshold values.
o ROC()
Default constructor

o ROC(char* filename)
Constructor.
It reads from a file the predicted and the target values. The first column of the data specifies the predicted values and the second the targets. File format: one predicted value and one target value for each line separated by blanks. The predicted values are loaded in the vector predicted and the targets in the vector target.
Parameters:
filename - name of the data file

o ROC(char* pred_file, char* target_file)
Constructor.
It reads from two different files the predicted and the target values. The first file stores the predicted values and the second the targets. The predicted values are loaded in the vector predicted and the targets in the vector target.
Parameters:
pred_file - name of the file storing the predicted values
target_file - name of the file storing the target values

ovoid read_data(char* filename)
Load predicted and target data from a file.
The first column of the data specifies the predicted values and the second the targets. File format: one predicted value and one target value for each line separated by blanks. The predicted values are loaded in the vector predicted and the targets in the vector target.
Parameters:
filename - name of the data file

ovoid read_data_2(char* pred_file, char* target_file)
Load predicted and target data from two separated files.
The first file stores the predicted values and the second the targets. The predicted values are loaded in the vector predicted and the targets in the vector target.
Parameters:
pred_file - name of the file storing the predicted values
target_file - name of the file storing the target values

ovoid do_conf_matrix(float thresh=0)
It builds a confusion matrix.
It reads the predicted and target vectors in order to calculate the confusion matrix using the threshold thresh. If the predicted value is above thresh it is considered ad a positive response, otherwise it is considered as negative.
Parameters:
thresh - Threshold used to compute the confusion matrix

oROCvalue* compute_ROC_value(float thresh)
It computes a ROCvalue.
It calculates the ROCvalues (sensitivity, specificity and precision), using a threshold to separate positive from negative examples.
Parameters:
thresh - Threshold used to compute the confusion matrix
Returns:
a pointer to the computed ROC value

ovoid compute_ROC_curve(int num_interval)
It computes a ROC curve
It computes a ROC curve, subdividing the output in a set of equidistant intervals. The limits of the intervals correspond to a different threshold and to a different computed ROC value.
Parameters:
num_interval - number of intervals

ovoid print_ROC_curve(void) const
It prints a ROC curve
It prints a ROC curve on stdout, printing sensitivity and 1-specificity pairs

ovoid print_ROC_curve_all(void) const
It prints a ROC curve considering also precision values
It prints a ROC curve on stdout, printing sensitivity, specificity, 1-specificity and precision

ovoid print_predicted(void) const
It prints the predicted data on stdout.

ovoid print_target(void) const
It prints the target data on stdout.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


Last Updated February 2001
For comments and suggestions mail to Giorgio Valentini