ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ConfusionMatrix.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include "utils/Types.hpp"
8
9#include <map>
10
21 std::map<int, int> get_labels_map(types::GroupIdVector const& y_pred, types::GroupIdVector const& y);
22
40 std::map<int, int> label_index;
41
43 ConfusionMatrix() = default;
44
52
58
63 float error() const;
64 };
65}
Statistical infrastructure for training and evaluation.
Definition ConfusionMatrix.hpp:11
std::map< int, int > get_labels_map(types::GroupIdVector const &y_pred, types::GroupIdVector const &y)
Build a sorted mapping from unique group labels to contiguous indices.
Eigen::Matrix< GroupId, Eigen::Dynamic, 1 > GroupIdVector
Dynamic-size column vector of internal group labels.
Definition Types.hpp:39
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
Generic dynamic-size column vector.
Definition Types.hpp:55
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
Generic dynamic-size matrix.
Definition Types.hpp:52
types::Matrix< int > values
The NxN confusion matrix (actual x predicted).
Definition ConfusionMatrix.hpp:39
ConfusionMatrix()=default
Default-construct an empty confusion matrix.
types::Vector< float > group_errors() const
Compute per-group error rates.
std::map< int, int > label_index
Map from group label to matrix row/column index.
Definition ConfusionMatrix.hpp:40
ConfusionMatrix(types::GroupIdVector const &y_pred, types::GroupIdVector const &y)
Construct a confusion matrix from predictions and actual labels.
float error() const
Compute the overall error rate (1 - accuracy).