artlib.supervised.ARTMAP

ARTMAP [12].

Classes

ARTMAP

ARTMAP for Classification and Regression.

Module Contents

class artlib.supervised.ARTMAP.ARTMAP(module_a: artlib.common.BaseART.BaseART, module_b: artlib.common.BaseART.BaseART)

Bases: artlib.supervised.SimpleARTMAP.SimpleARTMAP

ARTMAP for Classification and Regression.

This module implements ARTMAP as first published in: [12].

ARTMAP accepts two BaseART modules A and B which cluster the dependent channel (samples) and the independent channel (labels) respectively while linking them with a many-to-one mapping. If your labels are integers, use SimpleARTMAP for a faster and more direct implementation. ARTMAP also provides the ability to fit a regression model to data and specific functions have been implemented to allow this. However, FusionART provides substantially better fit for regression problems which are not monotonic.

module_b
get_params(deep: bool = True) dict

Get the parameters of the ARTMAP model.

Parameters:

deep (bool, optional) – If True, will return the parameters for this class and contained subobjects that are estimators.

Returns:

Parameter names mapped to their values.

Return type:

dict

property labels_a: numpy.ndarray

Get the labels generated by the A-side ART module.

Returns:

Labels for the A-side data (independent channel).

Return type:

np.ndarray

property labels_b: numpy.ndarray

Get the labels generated by the B-side ART module.

Returns:

Labels for the B-side data (dependent channel).

Return type:

np.ndarray

property labels_ab: Dict[str, numpy.ndarray]

Get the labels generated by both the A-side and B-side ART modules.

Returns:

Dictionary containing both A-side and B-side labels.

Return type:

dict

validate_data(X: numpy.ndarray, y: numpy.ndarray)

Validate the input data prior to clustering.

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

  • y (np.ndarray) – Data set B (dependent channel).

prepare_data(X: numpy.ndarray, y: numpy.ndarray | None = None) numpy.ndarray | Tuple[numpy.ndarray, numpy.ndarray]

Prepare data for clustering by normalizing and transforming.

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

  • y (np.ndarray) – Data set B (dependent channel).

Returns:

Normalized data for both channels.

Return type:

tuple of np.ndarray

restore_data(X: numpy.ndarray, y: numpy.ndarray | None = None) numpy.ndarray | Tuple[numpy.ndarray, numpy.ndarray]

Restore data to its original state before preparation.

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

  • y (np.ndarray) – Data set B (dependent channel).

Returns:

Restored data for both channels.

Return type:

tuple of np.ndarray

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 ARTMAP model to the data.

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

  • y (np.ndarray) – Data set B (dependent channel).

  • max_iter (int, optional) – Number of iterations to fit the model on the same data set.

  • match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – Method for resetting the vigilance parameter when match criterion fails.

  • epsilon (float, optional) – Small increment to modify the vigilance parameter.

  • verbose (bool, default=False) – If True, displays a progress bar during training.

  • leave_progress_bar (bool, default=True) – If True, leaves thge progress of the fitting process. Only used when verbose=True

Returns:

self – Fitted ARTMAP model.

Return type:

ARTMAP

partial_fit(X: numpy.ndarray, y: numpy.ndarray, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 1e-10)

Partially fit the ARTMAP model to the data.

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

  • y (np.ndarray) – Data set B (dependent channel).

  • match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – Method for resetting the vigilance parameter when match criterion fails.

  • epsilon (float, optional) – Small increment to modify the vigilance parameter.

Returns:

self – Partially fitted ARTMAP model.

Return type:

ARTMAP

predict(X: numpy.ndarray, clip: bool = False) numpy.ndarray

Predict the labels for the given data.

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

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

Returns:

Predicted labels for data set B (dependent channel).

Return type:

np.ndarray

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

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

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

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

Returns:

A labels and B labels for the data.

Return type:

tuple of np.ndarray

predict_regression(X: numpy.ndarray, clip: bool = False) numpy.ndarray

Predict values for the given data using cluster centers. Note: ARTMAP is not recommended for regression. Use FusionART for regression tasks.

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

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

Returns:

Predicted values using cluster centers.

Return type:

np.ndarray