Skip to main content

Module scoring

Module scoring 

Source
Expand description

Scoring: a lightweight metric abstraction usable standalone or, optionally, backed by smartcore::metrics.

The Scorer trait is deliberately tiny — a single score call over y_true / y_pred. Built-in scorers (accuracy, MAE, MSE, RMSE, R²) are implemented directly here so the crate needs no modeling dependency. For metrics that already exist in mature form elsewhere (F1, ROC-AUC, …), enable the smartcore-metrics feature to get smartcore_adapter rather than reimplementing them.

User-defined metrics are first-class: wrap any closure with make_scorer.

Modules§

smartcore_adapter
Feature-gated adapters wrapping smartcore::metrics as Scorers.

Structs§

Accuracy
Classification accuracy: the fraction of predictions that exactly match.
ClosureScorer
A Scorer backed by an arbitrary closure — the analogue of scikit-learn’s make_scorer, so users are never limited to the built-ins.
MeanAbsoluteError
Mean absolute error.
MeanSquaredError
Mean squared error.
R2Score
Coefficient of determination, R².
RootMeanSquaredError
Root mean squared error.

Traits§

Scorer
A scoring metric over true and predicted target vectors.

Functions§

make_scorer
Wrap a closure as a Scorer.