ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
Metrics.hpp File Reference

Mode-specific evaluation metric blocks. More...

#include "stats/ConfusionMatrix.hpp"
#include "utils/Types.hpp"
#include <optional>
#include <variant>

Go to the source code of this file.

Classes

struct  ppforest2::stats::ClassificationMetrics
 Classification evaluation metrics. More...
 
struct  ppforest2::stats::RegressionMetrics
 Regression evaluation metrics. More...
 

Namespaces

namespace  ppforest2
 Binarization strategies for multiclass-to-binary reduction.
 
namespace  ppforest2::stats
 Statistical infrastructure for training and evaluation.
 

Typedefs

using ppforest2::stats::Metrics = std::variant<ClassificationMetrics, RegressionMetrics>
 Mode-polymorphic metrics block.
 

Functions

float ppforest2::stats::accuracy (types::OutcomeVector const &predictions, types::GroupIdVector const &actual)
 Fraction of predictions matching the ground-truth class label.
 
double ppforest2::stats::error_rate (types::OutcomeVector const &predictions, types::GroupIdVector const &actual)
 Misclassification rate — 1 - accuracy.
 
double ppforest2::stats::error_rate (types::OutcomeVector const &predictions, types::OutcomeVector const &actual)
 Convenience overload: float-typed labels (cast to GroupId locally).
 
double ppforest2::stats::mae (types::OutcomeVector const &predictions, types::OutcomeVector const &actual)
 Mean absolute error.
 
Metrics ppforest2::stats::metrics_from_outcomes (types::OutcomeVector const &y_pred, types::OutcomeVector const &y, types::Mode mode)
 Build a mode-appropriate Metrics variant from in-memory tensors.
 
double ppforest2::stats::mse (types::OutcomeVector const &predictions, types::OutcomeVector const &actual)
 Mean squared error.
 
double ppforest2::stats::r_squared (types::OutcomeVector const &predictions, types::OutcomeVector const &actual)
 Coefficient of determination (R²). Returns 0 when total variance is 0.
 

Detailed Description

Mode-specific evaluation metric blocks.

Pairs ClassificationMetrics (confusion matrix + error rate) with RegressionMetrics (MSE / MAE / R²). Both are consumed together by the OOB / variant-based code paths in models/Evaluation.hpp, serialization, and presentation, so they live side by side.