seqme.models.PCA

seqme.models.PCA#

class seqme.models.PCA(embedder, reference, n_components)[source]#

Utility projecting sequence embeddings onto principle components.

__init__(embedder, reference, n_components)[source]#

Initialize principle component analysis.

Parameters:
  • embedder (Callable[[list[str]], ndarray]) – Embedding function.

  • reference (list[str]) – Reference sequences to fit PCA on.

  • n_components (int) – Number of principle components.

__call__(sequences)[source]#

Project sequences into PCA space.

Parameters:

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

Return type:

ndarray

Returns:

A NumPy array of shape (n_sequences, n_components) containing the embeddings.

Methods

__init__(embedder, reference, n_components)

Initialize principle component analysis.

__call__(sequences)

Project sequences into PCA space.

Attributes

variance_explained

Per-component explained variance ratio.