CGAL 5.1 - Classification
|
#include <CGAL/Classification/Evaluation.h>
Class to compute several measurements to evaluate the quality of a classification output.
Constructor | |
template<typename GroundTruthIndexRange , typename ResultIndexRange > | |
Evaluation (const Label_set &labels, const GroundTruthIndexRange &ground_truth, const ResultIndexRange &result) | |
Instantiates an evaluation object and computes all measurements. More... | |
Label Evaluation | |
float | precision (Label_handle label) const |
Returns the precision of the training for the given label. More... | |
float | recall (Label_handle label) const |
Returns the recall of the training for the given label. More... | |
float | f1_score (Label_handle label) const |
Returns the \(F_1\) score of the training for the given label. More... | |
float | intersection_over_union (Label_handle label) const |
Returns the intersection over union of the training for the given label. More... | |
Global Evaluation | |
float | accuracy () const |
Returns the accuracy of the training. More... | |
float | mean_f1_score () const |
Returns the mean \(F_1\) score of the training over all labels (see f1_score() ). | |
float | mean_intersection_over_union () const |
Returns the mean intersection over union of the training over all labels (see intersection_over_union() ). | |
CGAL::Classification::Evaluation::Evaluation | ( | const Label_set & | labels, |
const GroundTruthIndexRange & | ground_truth, | ||
const ResultIndexRange & | result | ||
) |
Instantiates an evaluation object and computes all measurements.
labels | labels used. |
ground_truth | vector of label indices: it should contain the index of the corresponding label in the Label_set provided in the constructor. Input items that do not have a ground truth information should be given the value -1 . |
result | similar to ground_truth but contained the result of a classification. |
float CGAL::Classification::Evaluation::accuracy | ( | ) | const |
Returns the accuracy of the training.
Accuracy is the total number of true positives divided by the total number of provided inliers.
float CGAL::Classification::Evaluation::f1_score | ( | Label_handle | label | ) | const |
Returns the \(F_1\) score of the training for the given label.
\(F_1\) score is the harmonic mean of precision()
and recall()
:
\[ F_1 = 2 \times \frac{precision \times recall}{precision + recall} \]
float CGAL::Classification::Evaluation::intersection_over_union | ( | Label_handle | label | ) | const |
Returns the intersection over union of the training for the given label.
Intersection over union is the number of true positives divided by the sum of the true positives, of the false positives and of the false negatives.
float CGAL::Classification::Evaluation::precision | ( | Label_handle | label | ) | const |
Returns the precision of the training for the given label.
Precision is the number of true positives divided by the sum of the true positives and the false positives.
float CGAL::Classification::Evaluation::recall | ( | Label_handle | label | ) | const |
Returns the recall of the training for the given label.
Recall is the number of true positives divided by the sum of the true positives and the false negatives.