artlib.optimized.backends.cpp.FuzzyARTMAP
Fuzzy ARTMAP [8].
Classes
FuzzyARTMAP for Classification. optimized with C++ |
Module Contents
- class artlib.optimized.backends.cpp.FuzzyARTMAP.FuzzyARTMAP(rho: float, alpha: float, beta: float)
Bases:
artlib.supervised.SimpleARTMAP.SimpleARTMAPFuzzyARTMAP for Classification. optimized with C++
This module implements FuzzyARTMAP
FuzzyARTMAP is a non-modular classification model which has been highly optimized for run-time performance. Fit and predict functions are implemented in c++ for efficient execution. This class acts as a wrapper for the underlying c++ functions and to provide compatibility with the artlib style and usage. Functionally, FuzzyARTMAP behaves as a special case of
SimpleARTMAPinstantiated withFuzzyART.- _synchronize_cpp_results(labels_a_out: numpy.ndarray, weights_arrays: list[numpy.ndarray], cluster_labels_out: numpy.ndarray, incremental: bool = False)
Synchronize the python class with the output of the c++ code.
- Parameters:
labels_a_out (np.ndarray) – A 1D numpy array containing the a-side labels from fitting
weights_arrays (np.ndarray) – A 2D numpy array where rows are the Fuzzy ART weights
cluster_labels_out (np.ndarray) – A 1D numpy array describing the map from a-side to b-side cluster labels
incremental (bool, default=False) – This flag is set to true when synchronizing after a partial_fit
- fit(X: numpy.ndarray, y: numpy.ndarray, max_iter: int = 1, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 1e-10, verbose: bool = False, leave_progress_bar: bool = True)
Fit the model to the data.
- Parameters:
X (np.ndarray) – Data set A.
y (np.ndarray) – Data set B.
max_iter (int, default=1) – Number of iterations to fit the model on the same data set.
match_tracking (Literal, default="MT+") – Method to reset the match.
epsilon (float, default=1e-10) – Small value to adjust the vigilance.
verbose (bool, default=False) – non functional. Left for compatibility
leave_progress_bar (bool, default=True) – non functional. Left for compatibility
- Returns:
self – The fitted model.
- Return type:
- partial_fit(X: numpy.ndarray, y: numpy.ndarray, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 1e-10)
Partial fit the model to the data.
- Parameters:
X (np.ndarray) – Data set A.
y (np.ndarray) – Data set B.
match_tracking (Literal, default="MT+") – Method to reset the match.
epsilon (float, default=1e-10) – Small value to adjust the vigilance.
- Returns:
self – The partially fitted model.
- Return type:
- predict(X: numpy.ndarray, clip: bool = False) numpy.ndarray
Predict labels for the data.
- Parameters:
X (np.ndarray) – Data set A.
clip (bool) – clip the input values to be between the previously seen data limits
- Returns:
B labels for the data.
- Return type:
np.ndarray