artlib.elementary.BinaryFuzzyART
Fuzzy ART [8].
Classes
Fuzzy ART optimized for binary input data. |
Functions
|
|
|
Optimized category choice for binary data using count_nonzero. |
Module Contents
- artlib.elementary.BinaryFuzzyART._and_popcount(i, w)
- artlib.elementary.BinaryFuzzyART._category_choice_binary(i: numpy.ndarray, w: numpy.ndarray, pre_MT: bool, rho_int: int) Tuple[int, bool]
Optimized category choice for binary data using count_nonzero.
- class artlib.elementary.BinaryFuzzyART.BinaryFuzzyART(rho: float)
Bases:
artlib.elementary.FuzzyART.FuzzyARTFuzzy ART optimized for binary input 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) – Dataset.
- category_choice(i: numpy.ndarray, w: numpy.ndarray, params: dict) tuple[int, dict | None]
Get the activation of the cluster using optimized binary operations.
- match_criterion(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: dict | None = None) Tuple[float, Dict | None]
Get the match criterion using optimized binary operations.
- 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:
- Returns:
Binary match criterion and cache used for later processing.
- Return type:
- set_weight(idx: int, new_w: numpy.ndarray, cache: dict | None = None)
Set the value of a cluster weight.
- update(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: dict | None = None) numpy.ndarray
Get the updated cluster weight using optimized binary operations.
- add_weight(new_w: numpy.ndarray)
Add a new cluster weight.
- Parameters:
new_w (np.ndarray) – New cluster weight to add.
- 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:
- _match_tracking_integer(cache: List[Dict] | Dict, epsilon: int, params: List[Dict] | Dict, method: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~']) bool
Perform match tracking using the specified method.
- Parameters:
- Returns:
Whether to continue searching for a match.
- Return type:
- 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 that influences cluster creation.
match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, default="MT+") – Method for resetting match criterion.
epsilon (float, default=0.0) – Epsilon value used for adjusting match criterion. Rounded up to nearest int
- Returns:
Cluster label of the input sample.
- Return type: