seqme.metrics.HitRate

seqme.metrics.HitRate#

class seqme.metrics.HitRate(condition_fn, *, name='Hit-rate')[source]#

Fraction of sequences that satisfy a user-defined condition.

__init__(condition_fn, *, name='Hit-rate')[source]#

Initializes the hit-rate metric.

Parameters:
  • condition_fn (Callable[[list[str]], ndarray]) – A function that takes a list of sequences and returns a boolean NumPy array of the same length, where True indicates a “hit” for that sequence.

  • name (str) – Name of the metric.

__call__(sequences)[source]#

Applies the filter to count hits and returns the average hit-rate.

Parameters:

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

Returns:

Proportion of sequences where condition_fn returned True, and standard error.

Return type:

MetricResult

Methods

__init__(condition_fn, *[, name])

Initializes the hit-rate metric.

__call__(sequences)

Applies the filter to count hits and returns the average hit-rate.

Attributes

name

Name of the metric.

objective

Whether lower or higher scores indicate better performance.