artlib.optimized.backends.cpp.BinaryFuzzyARTMAP

Binary Fuzzy ART [8].

Classes

BinaryFuzzyARTMAP

BinaryFuzzyARTMAP for Classification. optimized with C++

Module Contents

class artlib.optimized.backends.cpp.BinaryFuzzyARTMAP.BinaryFuzzyARTMAP(rho: float)

Bases: artlib.supervised.SimpleARTMAP.SimpleARTMAP

BinaryFuzzyARTMAP for Classification. optimized with C++

This module implements BinaryFuzzyARTMAP

BinaryFuzzyARTMAP 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, BinaryFuzzyARTMAP behaves as a special case of SimpleARTMAP instantiated with BinaryFuzzyART.

_synchronize_cpp_results(labels_a_out: numpy.ndarray, weights_arrays: 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 Binary 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=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:

SimpleARTMAP

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:

SimpleARTMAP

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

predict_ab(X: numpy.ndarray, clip: bool = False) tuple[numpy.ndarray, numpy.ndarray]

Predict labels for the data, both A-side and B-side.

Parameters:
  • X (np.ndarray) – Data set A.

  • clip (bool) – clip the input values to be between the previously seen data limits

Returns:

A labels for the data, B labels for the data.

Return type:

tuple[np.ndarray, np.ndarray]