CLiMB.core package

Submodules

CLiMB.core.CLiMB module

class CLiMB.core.CLiMB.CLiMB(constrained_clusters=3, seed_points=None, density_threshold=0.2, distance_threshold=15, radial_threshold=1, convergence_tolerance=0.4, exploratory_algorithm=None, distance_metric='euclidean', metric_params=None)

Bases: object

CLustering In Multiphase Boundaries (CLiMB)

A two-phase clustering algorithm designed for datasets with both known and exploratory components. First phase constrains clusters around known regions, second phase identifies new patterns in unassigned points.

compare_external_blob(path, filename, axis_names, hiding_cluster)

Compare known new blob and the clustered ones

fit(X, known_labels=None, is_slight_movement=False)

Execute two-stage clustering process

Parameters:

Xarray-like of shape (n_samples, n_features)

The input samples to cluster.

known_labelsarray-like, default=None

Known labels for seed points, if available.

is_slight_movementbool, default=False

Whether to use slight movement.

Returns:

selfCLiMB

Fitted estimator.

get_labels()

Get the cluster labels for all points

Returns:

labelsndarray

Cluster labels for each point

inverse_transform(scaler)

Transform clustering results back to original scale

Parameters:

scalerobject with inverse_transform method

The scaler used to normalize the data

plot_comprehensive_2d(dimensions=(0, 1), axis_labels=None, save_path=None, figsize=(15, 6), dpi=300)

Visualize both clustering stages in 2D

Parameters:

dimensionstuple, default=(0, 1)

Indices of dimensions to plot

axis_labelslist, default=None

Labels for X and Y axes

save_pathstr, default=None

Path to save the figure

figsizetuple, default=(15, 6)

Figure size

dpiint, default=300

Figure resolution

Returns:

figmatplotlib.figure.Figure

The created figure

plot_comprehensive_3d(axis_labels=None, save_path=None, figsize=(15, 6), dpi=300)

Visualize both clustering stages in 3D

Parameters:

axis_labelslist, default=None

Labels for X, Y, and Z axes

save_pathstr, default=None

Path to save the figure

figsizetuple, default=(15, 6)

Figure size

dpiint, default=300

Figure resolution

set_convergence(convergence)

Set convergence tolerance parameter

set_density(density)

Set density threshold parameter

set_distance(distance)

Set distance threshold parameter

set_exploratory_algorithm(exploratory_algorithm)

Set the exploratory clustering algorithm

Parameters:

exploratory_algorithmExploratoryClusteringBase

Algorithm for exploratory clustering phase

set_radial(radial)

Set radial threshold parameter

CLiMB.core.KBound module

class CLiMB.core.KBound.KBound(n_clusters, seeds=None, max_iter=300, density_threshold=0.5, distance_threshold=2.0, radial_threshold=1.0, convergence_tolerance=0.1, distance_metric='euclidean', metric_params=None)

Bases: object

fit(X, known_labels=None, is_slight_movement=False)

Perform density-constrained clustering with radial threshold constraints and custom distance metrics and seed points.

visualize_clustering(X)

Create comprehensive 3D visualization of clustering results

Module contents