seqme.metrics.Threshold

seqme.metrics.Threshold#

class seqme.metrics.Threshold(predictor, name, *, min_value=None, max_value=None)[source]#

Fraction of sequences with property within [min, max] a user-defined threshold.

__init__(predictor, name, *, min_value=None, max_value=None)[source]#

Initialize the metric.

Parameters:
  • predictor (Callable[[list[str]], ndarray]) – A function that takes a list of sequences and returns a 1D array of scalar values.

  • name (str) – Name of the metric.

  • min_value (Optional[float]) – Minimum threshold value.

  • max_value (Optional[float]) – Maximum threshold value.

__call__(sequences)[source]#

Applies the predictor to the sequences and returns the fraction of sequences within the threshold.

Parameters:

sequences (list[str]) – Sequences to evaluate.

Returns:

Fraction of sequences within the threshold, and the standard error.

Return type:

MetricResult

Methods

__init__(predictor, name, *[, min_value, ...])

Initialize the metric.

__call__(sequences)

Applies the predictor to the sequences and returns the fraction of sequences within the threshold.

Attributes

name

Name of the metric.

objective

Whether lower or higher scores indicate better performance.