artlib.elementary.BayesianART

Bayesian ART [4].

Classes

BayesianART

Bayesian ART for Clustering.

Module Contents

class artlib.elementary.BayesianART.BayesianART(rho: float, cov_init: numpy.ndarray)

Bases: artlib.common.BaseART.BaseART

Bayesian ART for Clustering.

This module implements Bayesian ART as first published in: [4].

Bayesian ART clusters data in Bayesian Distributions (Hyper-ellipsoids) and is similar to GaussianART but differs in that it allows arbitrary rotation of the hyper-ellipsoid.

pi2
static validate_params(params: dict)

Validate clustering parameters.

Parameters:

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

check_dimensions(X: numpy.ndarray)

Check that the data has the correct dimensions.

Parameters:

X (np.ndarray) – The dataset.

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.

match_criterion_bin(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: dict | None = None, op: Callable = operator.ge) tuple[bool, dict]

Get the binary 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.

  • op (callable, optional) – Operator for comparison, by default operator.ge.

Returns:

  • bool – Binary match criterion.

  • dict – Cache used for later processing.

_match_tracking(cache: List[Dict] | Dict, epsilon: float, params: List[Dict] | Dict, method: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~']) bool

Adjust match tracking based on the method and epsilon value.

Parameters:
  • cache (dict) – Cache containing intermediate results, including the match criterion.

  • epsilon (float) – Adjustment factor for the match criterion.

  • params (dict) – Dictionary containing algorithm parameters.

  • method ({"MT+", "MT-", "MT0", "MT1", "MT~"}) – Match tracking method to use.

Returns:

True if match tracking continues, False otherwise.

Return type:

bool

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:

Updated cluster weight.

Return type:

np.ndarray

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: Iterable, 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.