artlib.elementary.ART1
ART1 [1].
Classes
ART1 for Binary Clustering. |
Functions
|
Compute the match criterion for ART1 clustering. |
|
Compute the category choice activation for ART1. |
|
Optimized update function for ART1 using Numba. |
Module Contents
- artlib.elementary.ART1.match_criterion_numba(i, w_td, dim_)
Compute the match criterion for ART1 clustering.
This function calculates the proportion of active features in the input i that match the corresponding features in the top-down weight vector w_td.
- Parameters:
i (np.ndarray (int32 or uint8)) – Binary or integer input vector representing the data sample.
w_td (np.ndarray (uint8)) – Binary top-down weight vector of the cluster.
dim (int) – The number of features (dimensions) in the input vector.
- Returns:
The match criterion value, computed as the ratio of matching features to the total number of features.
- Return type:
- artlib.elementary.ART1.category_choice_numba(i, w_bu)
Compute the category choice activation for ART1.
This function calculates the category choice value, which represents the strength of association between an input i and a bottom-up weight vector w_bu.
- Parameters:
i (np.ndarray (int32 or uint8)) – Binary or integer input vector representing the data sample.
w_bu (np.ndarray (float32)) – Bottom-up weight vector of the cluster.
- Returns:
The activation value, computed as the sum of element-wise multiplications.
- Return type:
- artlib.elementary.ART1.update_numba(i, w, L, dim_)
Optimized update function for ART1 using Numba.
This function updates the cluster weight vector based on the input i, using ART1 learning rules.
- Parameters:
- Returns:
Updated cluster weight vector.
- Return type:
np.ndarray
- class artlib.elementary.ART1.ART1(rho: float, L: float)
Bases:
artlib.common.BaseART.BaseARTART1 for Binary Clustering.
This module implements ART1 as first published in: [1].
ART1 is exclusively for clustering binary data.
- 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.
- validate_data(X: numpy.ndarray)
Validate the data prior to clustering.
- 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:
- 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.