aaanalysis.AAclustPlot

class aaanalysis.AAclustPlot(model_class=<class 'sklearn.decomposition._pca.PCA'>, model_kwargs=None, verbose=True, random_state=None)[source]

Bases: object

Plotting class for AAclust (Amino Acid clustering) results [Breimann24a].

This class performs dimensionality reduction for visualization using decomposition models such as Principal Component Analysis (PCA).

Added in version 0.1.2.

Parameters:

Methods

centers(X[, labels, component_x, ...])

PCA plot of clustering with centers highlighted

correlation([df_corr, labels, labels_ref, ...])

Heatmap for correlation matrix with colored sidebar to label clusters.

eval([df_eval, figsize, dict_xlims])

Plots evaluation of n_clusters and clustering metrics BIC, CH, and SC from df_seq.

medoids(X[, labels, component_x, ...])

PCA plot of clustering with medoids highlighted

__init__(model_class=<class 'sklearn.decomposition._pca.PCA'>, model_kwargs=None, verbose=True, random_state=None)[source]
Parameters:
  • model_class (Type[TransformerMixin], default=PCA) – A decomposition model class with n_components parameter.

  • model_kwargs (dict, optional) – Keyword arguments to pass to the selected decomposition model.

  • verbose (bool, default=True) – If True, verbose outputs are enabled.

  • random_state (int, optional) – The seed used by the random number generator. If a positive integer, results of stochastic processes are consistent, enabling reproducibility. If None, stochastic processes will be truly random.

See also

Examples

The AAclustPlot object utilizes Transformer models, such as Principal Component Analysis (PCA), to visualize the AAclust clustering results. Valid models can be provided via the model_class parameter (default=PCA):

import aaanalysis as aa
# Valid transformer models
from sklearn.decomposition import PCA, KernelPCA, FastICA, TruncatedSVD, NMF
from sklearn.manifold import LocallyLinearEmbedding, Isomap
# Initialize AAclustPlot with PCA
aac_plot = aa.AAclustPlot(model_class=PCA)

Arguments of the transformer model can be set using the model_kwargs parameters:

aac_plot = aa.AAclustPlot(model_class=PCA, model_kwargs=dict(svd_solver="full"))