BaseClustering

Bases: BlueMathModel

Base class for all clustering BlueMath models. This class provides the basic structure for all clustering models.

Methods:

Name Description
fit
predict
fit_predict
plot_selected_centroids

data_color: str = "blue", centroids_color: str = "red", **kwargs

) -> Tuple[plt.figure, plt.axes]
plot_data_as_clusters

data: pd.DataFrame, nearest_centroids: np.ndarray, **kwargs

) -> Tuple[plt.figure, plt.axes]

fit(*args, **kwargs) abstractmethod

Fits the model to the data.

Parameters:
  • *args (list, default: () ) –

    Positional arguments.

  • **kwargs (dict, default: {} ) –

    Keyword arguments.

fit_predict(*args, **kwargs) abstractmethod

Fits the model to the data and predicts the clusters.

Parameters:
  • *args (list, default: () ) –

    Positional arguments.

  • **kwargs (dict, default: {} ) –

    Keyword arguments.

plot_data_as_clusters(data, nearest_centroids, **kwargs)

Plots data as nearest clusters.

Parameters:
  • data (DataFrame) –

    The data to plot.

  • nearest_centroids (ndarray) –

    The nearest centroids.

  • **kwargs (dict, default: {} ) –

    Additional keyword arguments to be passed to the scatter plot function.

Returns:
  • fig( figure ) –

    The figure object containing the plot.

  • axes( axes ) –

    The axes object for the plot.

plot_selected_centroids(data_color='blue', centroids_color='red', **kwargs)

Plots data and selected centroids on a scatter plot matrix.

Parameters:
  • data_color (str, default: 'blue' ) –

    Color for the data points. Default is "blue".

  • centroids_color (str, default: 'red' ) –

    Color for the centroid points. Default is "red".

  • **kwargs (dict, default: {} ) –

    Additional keyword arguments to be passed to the scatter plot function.

Returns:
  • fig( figure ) –

    The figure object containing the plot.

  • axes( axes ) –

    Array of axes objects for the subplots.

Raises:
  • ValueError

    If the data and centroids do not have the same number of columns or if the columns are empty.

predict(*args, **kwargs) abstractmethod

Predicts the clusters for the provided data.

Parameters:
  • *args (list, default: () ) –

    Positional arguments.

  • **kwargs (dict, default: {} ) –

    Keyword arguments.

BaseReduction

Bases: BlueMathModel

Base class for all dimensionality reduction BlueMath models. This class provides the basic structure for all dimensionality reduction models.

BaseSampling

Bases: BlueMathModel

Base class for all sampling BlueMath models. This class provides the basic structure for all sampling models.

Methods:

Name Description
generate

generate(*args, **kwargs) abstractmethod

Generates samples.

Parameters:
  • *args (list, default: () ) –

    Positional arguments.

  • **kwargs (dict, default: {} ) –

    Keyword arguments.

Returns:
  • DataFrame

    The generated samples.

plot_generated_data(data_color='blue', **kwargs)

Plots the generated data on a scatter plot matrix.

Parameters:
  • data_color (str, default: 'blue' ) –

    Color for the data points. Default is "blue".

  • **kwargs (dict, default: {} ) –

    Additional keyword arguments to be passed to the scatter plot function.

Returns:
  • fig( figure ) –

    The figure object containing the plot.

  • axes( axes ) –

    Array of axes objects for the subplots.

Raises:
  • ValueError

    If the data is empty.

ClusteringComparator

Class for comparing clustering models.

__init__(list_of_models)

Initializes the ClusteringComparator class.

fit(data, directional_variables=[], custom_scale_factor={})

Fits the clustering models.

plot_data_as_clusters(data)

Plots the data as clusters for the clustering models.

plot_selected_centroids()

Plots the selected centroids for the clustering models.