Metric
A metric scores model predictions against ground truth. Metrics accumulate
y_true and y_pred arrays across batches via
update(), then reduce them in
compute() to a single value (accuracy, MAE, TM-score,
Spearman’s ρ, etc.).
MultiMetric combines several metrics into one evaluation
pass. Result formats scores for console output, CSV, or
LaTeX tables and tracks whether higher or lower values are better.
Benchmarks call update() during evaluation,
which inverse-transforms predictions back to the original label space before
updating the metric. See Metrics.
- class bioverse.metric.Metric(property: str | None = None, name: str = 'Metric', reduction: str | None = 'mean', on: int = 1, per: int | None = None)[source]
Bases:
ABCScore model predictions against ground truth.
Metrics accumulate
y_trueandy_predarrays across evaluation batches viaupdate(), then compute a scalar incompute().Benchmarkcallsupdate()during validation and test;result()returns a formattedResult.Set
betterto"higher"or"lower"for leaderboard sorting. Usepropertyto select which field of a structured target array to score.Examples
from bioverse.metrics import MeanAbsoluteErrorMetric metric = MeanAbsoluteErrorMetric(property="target") metric.update(y_true, y_pred) result = metric.result(model_name="MyModel") result.to_console()
- class bioverse.metric.MultiMetric(metrics=[])[source]
Bases:
objectCombine multiple
Metricinstances into one evaluation pass.Metrics are updated and reduced independently. Use
+to build aMultiMetricfrom individual metrics.Examples
from bioverse.metrics import MeanAbsoluteErrorMetric, PearsonsRMetric metrics = MeanAbsoluteErrorMetric() + PearsonsRMetric() metrics.update(y_true, y_pred) metrics.result().to_console()
- class bioverse.metric.Result(data=[], better={})[source]
Bases:
objectFormatted collection of metric scores for display and export.
Results aggregate rows of
{Model, Metric, Value}dictionaries and track whether higher or lower values are better per metric. Supports console, LaTeX, and dictionary export viato_console(),to_latex(), andto_dict().