artlib.elementary.EllipsoidART

Ellipsoid ART [5], [6].

Classes

EllipsoidART

Ellipsoid ART for Clustering.

Module Contents

class artlib.elementary.EllipsoidART.EllipsoidART(rho: float, alpha: float, beta: float, mu: float, r_hat: float)

Bases: artlib.common.BaseART.BaseART

Ellipsoid ART for Clustering.

This module implements Ellipsoid ART as first published in: [5], [6].

Ellipsoid ART clusters data in Hyper-ellipsoids. It is highly sensitive to sample presentation order as the second sample will determine the orientation of the principal axes.

static validate_params(params: dict)

Validate clustering parameters.

Parameters:

params (dict) – Dictionary containing parameters for the algorithm.

static category_distance(i: numpy.ndarray, centroid: numpy.ndarray, major_axis: numpy.ndarray, params: dict) float

Calculate the distance between a sample and the cluster centroid.

Parameters:
  • i (np.ndarray) – Data sample.

  • centroid (np.ndarray) – Centroid of the cluster.

  • major_axis (np.ndarray) – Major axis of the cluster.

  • params (dict) – Dictionary containing parameters for the algorithm.

Returns:

Distance between the sample and the cluster centroid.

Return type:

float

category_choice(i: numpy.ndarray, w: numpy.ndarray, params: dict) tuple[float, dict | None]

Get the activation of the cluster.

Parameters:
  • i (np.ndarray) – Data sample.

  • w (np.ndarray) – Cluster weight or information.

  • params (dict) – Dictionary containing parameters for the algorithm.

Returns:

  • float – Cluster activation.

  • dict, optional – Cache used for later processing.

match_criterion(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: dict | None = None) Tuple[float, Dict | None]

Get the match criterion of the cluster.

Parameters:
  • i (np.ndarray) – Data sample.

  • w (np.ndarray) – Cluster weight or information.

  • params (dict) – Dictionary containing parameters for the algorithm.

  • cache (dict, optional) – Cache containing values from previous calculations.

Returns:

  • float – Cluster match criterion.

  • dict – Cache used for later processing.

update(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: dict | None = None) numpy.ndarray

Get the updated cluster weight.

Parameters:
  • i (np.ndarray) – Data sample.

  • w (np.ndarray) – Cluster weight or information.

  • params (dict) – Dictionary containing parameters for the algorithm.

  • cache (dict, optional) – Cache containing values from previous calculations.

Returns:

Updated cluster weight.

Return type:

np.ndarray

new_weight(i: numpy.ndarray, params: dict) numpy.ndarray

Generate a new cluster weight.

Parameters:
  • i (np.ndarray) – Data sample.

  • params (dict) – Dictionary containing parameters for the algorithm.

Returns:

New cluster weight.

Return type:

np.ndarray

get_2d_ellipsoids() List[Tuple[numpy.ndarray, float, float, float]]

Get the 2D ellipsoids for visualization.

Returns:

Each tuple contains the centroid, width, height, and angle of an ellipsoid.

Return type:

list of tuple

get_cluster_centers() List[numpy.ndarray]

Get the centers of each cluster, used for regression.

Returns:

Cluster centroids.

Return type:

list of np.ndarray

plot_cluster_bounds(ax: matplotlib.axes.Axes, colors: artlib.common.utils.IndexableOrKeyable, linewidth: int = 1)

Visualize the bounds of each cluster.

Parameters:
  • ax (matplotlib.axes.Axes) – Figure axes.

  • colors (IndexableOrKeyable) – Colors to use for each cluster.

  • linewidth (int, optional) – Width of boundary line, by default 1.