artlib.hierarchical.DeepARTMAP

Deep ARTMAP [12].

Classes

DeepARTMAP

DeepARTMAP for Hierachical Supervised and Unsupervised Learning.

Module Contents

class artlib.hierarchical.DeepARTMAP.DeepARTMAP(modules: list[artlib.common.BaseART.BaseART])

Bases: sklearn.base.BaseEstimator, sklearn.base.ClassifierMixin, sklearn.base.ClusterMixin

DeepARTMAP for Hierachical Supervised and Unsupervised Learning.

This module implements DeepARTMAP, a generalization of the ARTMAP class [12] that allows an arbitrary number of data channels to be divisively clustered. DeepARTMAP support both supervised and unsupervised modes. If only two ART modules are provided, DeepARTMAP reverts to standard ARTMAP where the first module is the A-module and the second module is the B-module. DeepARTMAP does not currently have a direct citation and is an original creation of this library.

modules
layers: list[artlib.common.BaseARTMAP.BaseARTMAP] = []
is_supervised: bool | None = None
get_params(deep: bool = True) dict

Get parameters for this estimator.

Parameters:

deep (bool, optional, default=True) – 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

set_params(**params)

Set the parameters of this estimator.

Parameters:

**params (dict) – Estimator parameters.

Returns:

self – The estimator instance.

Return type:

DeepARTMAP

property labels_: numpy.ndarray

Get the labels from the first layer.

Returns:

The labels from the first ART layer.

Return type:

np.ndarray

property labels_deep_: numpy.ndarray

Get the deep labels from all layers.

Returns:

Deep labels from all ART layers concatenated together.

Return type:

np.ndarray

property n_modules: int

Get the number of ART modules.

Returns:

The number of ART modules.

Return type:

int

property n_layers: int

Get the number of layers.

Returns:

The number of layers in DeepARTMAP.

Return type:

int

map_deep(level: int, y_a: numpy.ndarray | int) numpy.ndarray | int

Map a label from one arbitrary level to the highest (B) level.

Parameters:
  • level (int) – The level from which the label is taken.

  • y_a (np.ndarray or int) – The cluster label(s) at the input level.

Returns:

The cluster label(s) at the highest level (B).

Return type:

np.ndarray or int

validate_data(X: list[numpy.ndarray], y: numpy.ndarray | None = None)

Validate the data before clustering.

Parameters:
  • X (list of np.ndarray) – The input data sets for each module.

  • y (np.ndarray, optional) – The corresponding labels, by default None.

Raises:

AssertionError – If the input data is inconsistent or does not match the expected format.

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

Prepare the data for clustering.

Parameters:
  • X (list of np.ndarray) – The input data set for each module.

  • y (np.ndarray, optional) – The corresponding labels, by default None.

Returns:

The prepared data set and labels (if any).

Return type:

tuple of (list of np.ndarray, np.ndarray)

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

Restore the data to its original state before preparation.

Parameters:
  • X (list of np.ndarray) – The input data set for each module.

  • y (np.ndarray, optional) – The corresponding labels, by default None.

Returns:

The restored data set and labels (if any).

Return type:

tuple of (list of np.ndarray, np.ndarray)

fit(X: list[numpy.ndarray], y: numpy.ndarray | None = None, max_iter=1, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0)

Fit the DeepARTMAP model to the data.

Parameters:
  • X (list of np.ndarray) – The input data sets for each module.

  • y (np.ndarray, optional) – The corresponding labels for supervised learning, by default None.

  • max_iter (int, optional) – The number of iterations to fit the model, by default 1.

  • match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – The method to reset vigilance if a mismatch occurs, by default “MT+”.

  • epsilon (float, optional) – A small adjustment factor for match tracking, by default 0.0.

Returns:

The fitted DeepARTMAP model.

Return type:

DeepARTMAP

partial_fit(X: list[numpy.ndarray], y: numpy.ndarray | None = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0)

Partially fit the DeepARTMAP model to the data.

Parameters:
  • X (list of np.ndarray) – The input data sets for each module.

  • y (np.ndarray, optional) – The corresponding labels for supervised learning, by default None.

  • match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – The method to reset vigilance if a mismatch occurs, by default “MT+”.

  • epsilon (float, optional) – A small adjustment factor for match tracking, by default 0.0.

Returns:

The partially fitted DeepARTMAP model.

Return type:

DeepARTMAP

predict(X: numpy.ndarray | list[numpy.ndarray], clip: bool = False) list[numpy.ndarray]

Predict the labels for the input data.

Parameters:
  • X (np.ndarray or list of np.ndarray) – The input data set for prediction.

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

Returns:

The predicted labels for each layer.

Return type:

list of np.ndarray