artlib.hierarchical.SMART
SMART [14].
Classes
SMART for Hierachical Clustering. |
Module Contents
- class artlib.hierarchical.SMART.SMART(base_ART_class: Type, rho_values: list[float] | numpy.ndarray, base_params: dict, **kwargs)
Bases:
artlib.hierarchical.DeepARTMAP.DeepARTMAPSMART for Hierachical Clustering.
This module implements SMART as first published in: [14]
SMART accepts an uninstantiated
BaseARTclass and hierarchically clusters data in a divisive fashion by using a set of vigilance values that monotonically increase in their restrictiveness. SMART is a special case ofDeepARTMAP, which forms the backbone of this class, where all channels receive the same data.- rho_values
- prepare_data(X: numpy.ndarray | list[numpy.ndarray], y: numpy.ndarray | None = None) numpy.ndarray | Tuple[list[numpy.ndarray], numpy.ndarray | None]
Prepare data for clustering.
- Parameters:
X (np.ndarray) – The dataset to prepare.
- Returns:
Prepared data.
- Return type:
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 data to its original form before preparation.
- Parameters:
X (np.ndarray) – The dataset to restore.
- Returns:
Restored data.
- Return type:
np.ndarray
- fit(X: 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 SMART model to the data.
- Parameters:
X (np.ndarray) – The dataset to fit the model on.
y (np.ndarray, optional) – Not used, present for compatibility.
max_iter (int, optional) – The number of iterations to run the model on the data.
match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – The match reset method to use when adjusting vigilance.
epsilon (float, optional) – A small value to adjust vigilance during match tracking.
- Returns:
Fitted SMART model.
- Return type:
- partial_fit(X: numpy.ndarray, y: numpy.ndarray | None = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0)
Partial fit the SMART model to the data.
- Parameters:
X (np.ndarray) – The dataset to partially fit the model on.
y (np.ndarray, optional) – Not used, present for compatibility.
match_tracking ({"MT+", "MT-", "MT0", "MT1", "MT~"}, optional) – The match reset method to use when adjusting vigilance.
epsilon (float, optional) – A small value to adjust vigilance during match tracking.
- Returns:
Partially fitted SMART model.
- Return type:
- plot_cluster_bounds(ax: matplotlib.axes.Axes, colors: artlib.common.utils.IndexableOrKeyable, linewidth: int = 1)
Visualize the cluster boundaries.
- Parameters:
ax (Axes) – The matplotlib axes on which to plot the cluster boundaries.
colors (IndexableOrKeyable) – The colors to use for each cluster.
linewidth (int, optional) – The width of the boundary lines.
- Return type:
None
- 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 with cluster boundaries.
- Parameters:
X (np.ndarray) – The dataset to visualize.
y (np.ndarray) – The cluster labels for the data points.
ax (Axes, optional) – The matplotlib axes on which to plot the visualization.
marker_size (int, optional) – The size of the data points in the plot.
linewidth (int, optional) – The width of the cluster boundary lines.
colors (IndexableOrKeyable, optional) – The colors to use for each cluster.
- Return type:
None