Nous.Eval.Compare.Metric (nous v0.21.1)

Copy Markdown View Source

The per-case metrics Nous.Eval.Compare can gate on and break down by.

Every metric is a value per case in 0.0..1.0, so the unit of the paired bootstrap is the case:

  • :pass_rate - the share of the case's scored (:pass/:fail) samples that passed
  • :case_score - the mean of the samples' gated case_score (see Nous.Eval.Scoring)
  • {:scorer, name} - the share of the case's samples whose score named name (a Nous.Eval.Score name such as "contains" or "judge.relevance") has passed?: true, regardless of how scores are composed into the verdict

A metric is undefined for a case without the data it needs (no scored sample, no case_score, no score of that name); such cases are left out of that metric's comparison.

Command-line and config values are strings: "pass_rate", "case_score" and "scorer:<name>" parse through a closed table, never into new atoms.

Summary

Functions

The string form of a metric (the inverse of parse/1).

Validates a metric given as a term or a string.

Types

t()

@type t() :: :pass_rate | :case_score | {:scorer, String.t()}

Functions

name(arg1)

@spec name(t()) :: String.t()

The string form of a metric (the inverse of parse/1).

Examples

iex> Nous.Eval.Compare.Metric.name({:scorer, "contains"})
"scorer:contains"

parse(metric)

@spec parse(term()) :: {:ok, t()} | {:error, {:invalid_metric, term()}}

Validates a metric given as a term or a string.

Examples

iex> Nous.Eval.Compare.Metric.parse("scorer:judge.relevance")
{:ok, {:scorer, "judge.relevance"}}

iex> Nous.Eval.Compare.Metric.parse("accuracy")
{:error, {:invalid_metric, "accuracy"}}