seqme.metrics.FBD

seqme.metrics.FBD#

class seqme.metrics.FBD(reference, embedder, *, name='FBD')[source]#

Fréchet Biological Distance (FBD) between a set of generated sequences and a reference dataset based on their embeddings.

This metric estimates how similar the distributions of two groups of embeddings are using the Wasserstein-2 (Fréchet) distance. It is analogous to the Fréchet Inception Distance (FID) [1], except that the embeddings are obtained from a biologically relevant model rather than InceptionNet.

References

[1] Heusel et al., “GANs Trained by a Two Time-Scale Update Rule Converge to a

Local Nash Equilibrium” (https://arxiv.org/abs/1706.08500)

__init__(reference, embedder, *, name='FBD')[source]#

Initializes the metric with a reference dataset and an embedding function.

Parameters:
  • reference (list[str]) – A list of reference sequences (e.g., real data).

  • embedder (Callable[[list[str]], ndarray]) – A function that maps a list of sequences to a 2D NumPy array of embeddings.

  • name (str) – Metric name.

Raises:

ValueError – If fewer than 2 reference embeddings are provided.

__call__(sequences)[source]#

Compute the FBD between the reference and the input sequences.

Parameters:

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

Returns:

FBD score.

Return type:

MetricResult

Methods

__init__(reference, embedder, *[, name])

Initializes the metric with a reference dataset and an embedding function.

__call__(sequences)

Compute the FBD between the reference and the input sequences.

Attributes

name

Name of the metric.

objective

Whether lower or higher scores indicate better performance.