artlib.common.BaseARTMAP

Base class for all ARTMAP objects.

Classes

BaseARTMAP

Generic implementation of Adaptive Resonance Theory MAP (ARTMAP)

Module Contents

class artlib.common.BaseARTMAP.BaseARTMAP

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

Generic implementation of Adaptive Resonance Theory MAP (ARTMAP)

map: dict[int, int]
set_params(**params)

Set the parameters of this estimator.

Specific redefinition of sklearn.BaseEstimator.set_params for ARTMAP classes.

Parameters:

**params (dict) – Estimator parameters.

Returns:

self – Estimator instance.

Return type:

object

map_a2b(y_a: numpy.ndarray | int) numpy.ndarray | int

Map an a-side label to a b-side label.

Parameters:

y_a (Union[np.ndarray, int]) – Side A label(s).

Returns:

Side B cluster label(s).

Return type:

Union[np.ndarray, int]

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

Validate the data prior to clustering.

Parameters:
  • X (np.ndarray) – Dataset A.

  • y (np.ndarray) – Dataset B.

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

Fit the model to the data.

Parameters:
  • X (np.ndarray) – Dataset A.

  • y (np.ndarray) – Dataset B.

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

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

  • epsilon (float, optional) – Epsilon value used for adjusting match criterion, by default 1e-10.

abstract 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) – Dataset A.

  • y (np.ndarray) – Dataset B.

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

  • epsilon (float, optional) – Epsilon value used for adjusting match criterion, by default 1e-10.

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

Predict labels for the data.

Parameters:
  • X (np.ndarray) – Dataset A.

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

Returns:

B-side labels for the data.

Return type:

np.ndarray

abstract 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) – Dataset A.

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

Returns:

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

Return type:

tuple[np.ndarray, np.ndarray]

abstract plot_cluster_bounds(ax: matplotlib.axes.Axes, colors: artlib.common.utils.IndexableOrKeyable, linewidth: int = 1)

Visualize the bounds of each cluster.

Parameters:
  • ax (matplotlib.axes.Axes) – Figure axes.

  • colors (IndexableOrKeyable) – Colors to use for each cluster.

  • linewidth (int, optional) – Width of boundary line, by default 1.

abstract visualize(X: numpy.ndarray, y: numpy.ndarray, ax: matplotlib.axes.Axes | None = None, marker_size: int = 10, linewidth: int = 1, colors: artlib.common.utils.IndexableOrKeyable | None = None)

Visualize the clustering of the data.

Parameters:
  • X (np.ndarray) – Dataset.

  • y (np.ndarray) – Sample labels.

  • ax (matplotlib.axes.Axes, optional) – Figure axes, by default None.

  • marker_size (int, optional) – Size used for data points, by default 10.

  • linewidth (int, optional) – Width of boundary line, by default 1.

  • colors (IndexableOrKeyable, optional) – Colors to use for each cluster, by default None.