artlib.optimized.backends.cpp.FuzzyARTMAP ========================================= .. py:module:: artlib.optimized.backends.cpp.FuzzyARTMAP .. autoapi-nested-parse:: Fuzzy ARTMAP :cite:`carpenter1991fuzzy`. Classes ------- .. autoapisummary:: artlib.optimized.backends.cpp.FuzzyARTMAP.FuzzyARTMAP Module Contents --------------- .. py:class:: FuzzyARTMAP(rho: float, alpha: float, beta: float) Bases: :py:obj:`artlib.supervised.SimpleARTMAP.SimpleARTMAP` FuzzyARTMAP 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 :class:`~artlib.supervised.SimpleARTMAP.SimpleARTMAP` instantiated with :class:`~artlib.elementary.FuzzyART.FuzzyART`. .. py:method:: _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. :param labels_a_out: A 1D numpy array containing the a-side labels from fitting :type labels_a_out: np.ndarray :param weights_arrays: A 2D numpy array where rows are the Fuzzy ART weights :type weights_arrays: np.ndarray :param cluster_labels_out: A 1D numpy array describing the map from a-side to b-side cluster labels :type cluster_labels_out: np.ndarray :param incremental: This flag is set to true when synchronizing after a partial_fit :type incremental: bool, default=False .. py:method:: 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. :param X: Data set A. :type X: np.ndarray :param y: Data set B. :type y: np.ndarray :param max_iter: Number of iterations to fit the model on the same data set. :type max_iter: int, default=1 :param match_tracking: Method to reset the match. :type match_tracking: Literal, default="MT+" :param epsilon: Small value to adjust the vigilance. :type epsilon: float, default=1e-10 :param verbose: non functional. Left for compatibility :type verbose: bool, default=False :param leave_progress_bar: non functional. Left for compatibility :type leave_progress_bar: bool, default=True :returns: **self** -- The fitted model. :rtype: SimpleARTMAP .. py:method:: 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. :param X: Data set A. :type X: np.ndarray :param y: Data set B. :type y: np.ndarray :param match_tracking: Method to reset the match. :type match_tracking: Literal, default="MT+" :param epsilon: Small value to adjust the vigilance. :type epsilon: float, default=1e-10 :returns: **self** -- The partially fitted model. :rtype: SimpleARTMAP .. py:method:: predict(X: numpy.ndarray, clip: bool = False) -> numpy.ndarray Predict labels for the data. :param X: Data set A. :type X: np.ndarray :param clip: clip the input values to be between the previously seen data limits :type clip: bool :returns: B labels for the data. :rtype: np.ndarray .. py:method:: predict_ab(X: numpy.ndarray, clip: bool = False) -> Tuple[numpy.ndarray, numpy.ndarray] Predict labels for the data, both A-side and B-side. :param X: Data set A. :type X: np.ndarray :param clip: clip the input values to be between the previously seen data limits :type clip: bool :returns: A labels for the data, B labels for the data. :rtype: tuple[np.ndarray, np.ndarray]