Clustering Data Helper

GitHub Link to Code.

Helper for loading clustering data and colors.

Centralizes clustering data access logic used across multiple plotters.

class mdxplain.plots.helper.clustering_data_helper.ClusteringDataHelper

Helper for loading clustering data and colors.

Provides centralized access to clustering labels and color mappings, used by multiple plotter types (time series, landscape, membership).

Examples

>>> labels, colors = ClusteringDataHelper.load_clustering_data(
...     pipeline_data, "dbscan"
... )
static load_clustering_data(pipeline_data: PipelineData, clustering_name: str) Tuple[np.ndarray, Dict[int, str]]

Load clustering labels and color mapping.

Parameters

pipeline_dataPipelineData

Pipeline data container

clustering_namestr

Name of clustering to load

Returns

labelsnumpy.ndarray

Cluster labels for all frames

cluster_colorsDict[int, str]

Mapping from cluster ID to color

Examples

>>> labels, colors = ClusteringDataHelper.load_clustering_data(
...     pipeline_data, "dbscan"
... )
>>> print(labels.shape)  # (n_frames,)
>>> print(colors[0])  # '#color_hex'