Skip to content

Metrics averagerow

github-actions[bot] edited this page Aug 26, 2026 · 28 revisions

Development build. This page describes main, not a released package. The latest published Lodestar.Metrics is 0.3.0 — read its documentation.

AverageRow

One averaged line of a report: macro avg, weighted avg or micro avg, with the same four columns a class row has.

public sealed record AverageRow(string Name, double Precision, double Recall, double F1, double Support)

PropertiesName is the label scikit-learn prints for the row. Precision, Recall and F1 are the averaged scores, reduced the way the row's name says. Support is the total weight the average covers, which is the same for all three rows of one report.

Example — the macro row of the three-class report below.

using Lodestar.Metrics;

int[] yTrue = [0, 0, 1, 1, 2, 2, 2];
int[] yPred = [0, 1, 1, 1, 2, 2, 0];

ClassificationReport report = ClassificationReport.Compute(yTrue, yPred);
AverageRow macro = report.MacroAverage;
double f1 = macro.F1;         // => 0.7000…
double support = macro.Support;   // => 7

Remarks — a record, so it is compared by value and prints its own contents, which makes it useful in a test assertion without any ceremony. The three rows a report can hold are MacroAverage, WeightedAverage and — only when an explicit label subset dropped samples — MicroAverage.

The trap is Support on this row versus on a ClassRow. A class row's support is that class's own weight; every average row carries the total, so summing the supports of a report's rows double counts. Read TotalSupport off the report if that is what you want.

Applies to — net10.0, netstandard2.0.

See alsoClassificationReport.Compute, the Python equivalence table.

Members

Member What it does

Lodestar

Project

Clone this wiki locally