artlib.elementary.FuzzyART
Fuzzy ART [8].
Classes
Fuzzy ART for Clustering. |
Functions
|
Extract the bounding boxes from a FuzzyART weight. |
|
Compute the category choice (activation) using Numba optimization. |
|
Compute the match criterion using Numba optimization. |
|
Compute the updated cluster weight using Numba optimization. |
Module Contents
- artlib.elementary.FuzzyART.get_bounding_box(w: numpy.ndarray, n: int | None = None) tuple[list[int], list[int]]
Extract the bounding boxes from a FuzzyART weight.
- artlib.elementary.FuzzyART._category_choice_numba(i: numpy.ndarray, w: numpy.ndarray, alpha: float) float
Compute the category choice (activation) using Numba optimization.
- artlib.elementary.FuzzyART._match_criterion_numba(i: numpy.ndarray, w: numpy.ndarray, dim_original: float) float
Compute the match criterion using Numba optimization.
- artlib.elementary.FuzzyART._update_numba(i: numpy.ndarray, w: numpy.ndarray, b: float | None) numpy.ndarray
Compute the updated cluster weight using Numba optimization.
- Parameters:
i (np.ndarray) – Data sample.
w (np.ndarray) – Cluster weight or information.
b (float, optional) – Learning rate parameter (beta). If None, only the fuzzy AND operation is applied.
- Returns:
Updated cluster weight.
- Return type:
np.ndarray
- class artlib.elementary.FuzzyART.FuzzyART(rho: float, alpha: float, beta: float)
Bases:
artlib.common.BaseART.BaseARTFuzzy ART for Clustering.
This module implements Fuzzy ART as first published in: [8].
Fuzzy ART is a hyper-box based clustering method that is exceptionally fast and explainable.
- prepare_data(X: numpy.ndarray) numpy.ndarray
Prepare data for clustering.
- Parameters:
X (np.ndarray) – Dataset.
- Returns:
Normalized and complement coded data.
- Return type:
np.ndarray
- restore_data(X: numpy.ndarray) numpy.ndarray
Restore data to its state prior to preparation.
- Parameters:
X (np.ndarray) – Dataset.
- Returns:
Restored data.
- Return type:
np.ndarray
- 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) – Dataset.
- validate_data(X: numpy.ndarray)
Validate the data prior to clustering.
- Parameters:
X (np.ndarray) – 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:
- 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.
- 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_bounding_boxes(n: int | None = None) List[tuple[list[int], list[int]]]
Get the bounding boxes for each cluster.
- 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.