Skip to content

Metrics classificationreport tostring

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.

ClassificationReport.ToString

The two-digit table, so that printing a report does something useful.

public string ToString()

Returnsstring, exactly what ToText(2) returns.

Example — the two are the same call.

using System;
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);
bool same = string.Equals(report.ToString(), report.ToText(2), StringComparison.Ordinal);   // => True

Remarks — an override rather than the default Lodestar.Metrics.ClassificationReport, because a report in a debugger watch window or an interpolated string is nearly always something a human is about to read. It carries no information ToText does not.

The trap is the one every ToString override has: it is not a serialization format and it is not stable across a digits you did not choose. Log ToText(digits) if the number of decimal places matters to whatever reads the log.

Applies to — net10.0, netstandard2.0.

See alsoClassificationReport.ToText, ClassificationReport.Compute, the Python equivalence table.

Lodestar

Project

Clone this wiki locally