artlib.topological.DualVigilanceART

Dual Vigilance ART [19].

Classes

DualVigilanceART

Dual Vigilance ART for Clustering.

Module Contents

class artlib.topological.DualVigilanceART.DualVigilanceART(base_module: artlib.common.BaseART.BaseART, rho_lower_bound: float)

Bases: artlib.common.BaseART.BaseART

Dual Vigilance ART for Clustering.

This module implements Dual Vigilance ART as first published in: [19].

Dual Vigilance ART allows a BaseART module to cluster with both an upper and lower vigilance value. The upper-vigilance value allows the BaseART module to cluster normally, however, data is simultaneously clustered using the lower vigilance level to combine multiple base ART categories into a single abstracted category. This permits clusters to be combined to form arbitrary shapes. For example if the BaseART module is FuzzyART, a Dual Vigilance Fuzzy ART clustering result would look like a series of hyper-boxes forming an arbitrary geometry.

base_module
rho_lower_bound
map: dict[int, int]
prepare_data(X: numpy.ndarray) numpy.ndarray

Prepare data for clustering.

Parameters:

X (np.ndarray) – The dataset.

Returns:

Prepared data from the base module.

Return type:

np.ndarray

restore_data(X: numpy.ndarray) numpy.ndarray

Restore data to its state prior to preparation.

Parameters:

X (np.ndarray) – The dataset.

Returns:

Restored data from the base module.

Return type:

np.ndarray

get_params(deep: bool = True) dict

Get the parameters of the estimator.

Parameters:

deep (bool, optional) – If True, return the parameters for this class and contained subobjects that are estimators, by default True.

Returns:

Parameter names mapped to their values.

Return type:

dict

property n_clusters: int

Get the current number of clusters.

Returns:

The number of clusters.

Return type:

int

property dim_

Get the dimensionality of the data from the base module.

Returns:

Dimensionality of the data.

Return type:

int

property labels_

Get the labels from the base module.

Returns:

Labels for the data.

Return type:

np.ndarray

property W: List

Get the weights from the base module.

Returns:

Weights of the clusters.

Return type:

list of np.ndarray

check_dimensions(X: numpy.ndarray)

Check that the data has the correct dimensions.

Parameters:

X (np.ndarray) – The dataset.

validate_data(X: numpy.ndarray)

Validate the data prior to clustering.

Parameters:

X (np.ndarray) – The dataset.

static validate_params(params: dict)

Validate clustering parameters.

Parameters:

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

_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

_set_params(new_params)
_deep_copy_params() dict
step_fit(x: numpy.ndarray, match_reset_func: Callable | None = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0) int

Fit the model to a single sample.

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

  • match_reset_func (callable, optional) – A callable accepting the data sample, a cluster weight, the params dict, and the cache dict. Returns True if the cluster is valid for the sample, False otherwise.

  • match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – Method for resetting match criterion, by default “MT+”.

  • epsilon (float, optional) – Epsilon value used for adjusting match criterion, by default 0.0.

Returns:

Cluster label of the input sample.

Return type:

int

step_pred(x) int

Predict the label for a single sample.

Parameters:

x (np.ndarray) – Data sample.

Returns:

Cluster label of the input sample.

Return type:

int

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.