nvalchemi.training.distillation.evaluation.AcceptanceBar#

class nvalchemi.training.distillation.evaluation.AcceptanceBar(name, families, check='', attribute='', comparison='<=', quantities=(), missing='')[source]#

Where one acceptance bar reads the number it gates, and which way it passes.

An acceptance bar is a limit that one number from a student’s measurements must clear for the student to be accepted. The built-in bars are DEFAULT_BARS. To register a custom bar, pass a table that includes it to build_acceptance_report() and measured_bars(). Set its limit under its name in AcceptanceThresholds.extra, and file its number under its family in StudentEvaluation.extra.

Parameters:
  • name (str) – Name the bar’s limit is set under: a field of AcceptanceThresholds for a built-in bar, or a key of its extra for a custom one.

  • families (tuple[str, ...]) – Measurement slots the bar reads. A slot of StudentEvaluation names a typed measurement. "extra:<family>" names a map of numbers under StudentEvaluation.extra.

  • check (str, optional) – Row the bar reports under. Unless attribute overrides it, this is also the field or key the bar reads from its first family. Required for every bar but the built-in from-scratch ratio, which spans two families and is computed by the report itself. Default "".

  • attribute (str, optional) – Field or key read when it differs from check. Default "".

  • comparison ({"<=", ">="}, optional) – Direction the check passes in. Default "<=".

  • quantities (tuple[str, ...], optional) – Accuracy quantities, any one of which is enough to decide the bar. measured_bars() uses them to narrow its answer. Default ().

  • missing (str, optional) – Detail reported when the family was supplied but the number it reads was not. Default "".

Raises:

ValueError – If name or families is empty, if check is empty for any bar but the from-scratch ratio, if a family is neither a measurement slot nor an "extra:" family, or if comparison is not "<=" or ">=".

Examples

>>> from nvalchemi.training.distillation.evaluation import (
...     DEFAULT_BARS,
...     AcceptanceBar,
... )
>>> dipole_bar = AcceptanceBar(
...     "max_dipole_mae", ("extra:dipole",), "dipole_mae"
... )
>>> bars = (*DEFAULT_BARS, dipole_bar)