artlib.hierarchical.SMART ========================= .. py:module:: artlib.hierarchical.SMART .. autoapi-nested-parse:: SMART :cite:`bartfai1994hierarchical`. Classes ------- .. autoapisummary:: artlib.hierarchical.SMART.SMART Module Contents --------------- .. py:class:: SMART(base_ART_class: Type, rho_values: Union[list[float], numpy.ndarray], base_params: dict, **kwargs) Bases: :py:obj:`artlib.hierarchical.DeepARTMAP.DeepARTMAP` SMART for Hierachical Clustering. This module implements SMART as first published in: :cite:`bartfai1994hierarchical` .. # Bartfai, G. (1994). .. # Hierarchical clustering with ART neural networks. .. # In Proc. IEEE International Conference on Neural Networks (ICNN) .. # (pp. 940–944). volume 2. .. # doi:10.1109/ICNN.1994.374307. SMART accepts an uninstantiated :class:`~artlib.common.BaseART.BaseART` class 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 of :class:`~artlib.hierarchical.DeepARTMAP.DeepARTMAP`, which forms the backbone of this class, where all channels receive the same data. .. py:attribute:: rho_values .. py:method:: prepare_data(X: Union[numpy.ndarray, list[numpy.ndarray]], y: Optional[numpy.ndarray] = None) -> Union[numpy.ndarray, Tuple[list[numpy.ndarray], Optional[numpy.ndarray]]] Prepare data for clustering. :param X: The dataset to prepare. :type X: np.ndarray :returns: Prepared data. :rtype: np.ndarray .. py:method:: restore_data(X: Union[numpy.ndarray, list[numpy.ndarray]], y: Optional[numpy.ndarray] = None) -> Union[numpy.ndarray, Tuple[list[numpy.ndarray], Optional[numpy.ndarray]]] Restore data to its original form before preparation. :param X: The dataset to restore. :type X: np.ndarray :returns: Restored data. :rtype: np.ndarray .. py:method:: fit(X: numpy.ndarray, y: Optional[numpy.ndarray] = None, max_iter=1, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0) Fit the SMART model to the data. :param X: The dataset to fit the model on. :type X: np.ndarray :param y: Not used, present for compatibility. :type y: np.ndarray, optional :param max_iter: The number of iterations to run the model on the data. :type max_iter: int, optional :param match_tracking: The match reset method to use when adjusting vigilance. :type match_tracking: {"MT+", "MT-", "MT0", "MT1", "MT~"}, optional :param epsilon: A small value to adjust vigilance during match tracking. :type epsilon: float, optional :returns: Fitted SMART model. :rtype: SMART .. py:method:: partial_fit(X: numpy.ndarray, y: Optional[numpy.ndarray] = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0) Partial fit the SMART model to the data. :param X: The dataset to partially fit the model on. :type X: np.ndarray :param y: Not used, present for compatibility. :type y: np.ndarray, optional :param match_tracking: The match reset method to use when adjusting vigilance. :type match_tracking: {"MT+", "MT-", "MT0", "MT1", "MT~"}, optional :param epsilon: A small value to adjust vigilance during match tracking. :type epsilon: float, optional :returns: Partially fitted SMART model. :rtype: SMART .. py:method:: plot_cluster_bounds(ax: matplotlib.axes.Axes, colors: artlib.common.utils.IndexableOrKeyable, linewidth: int = 1) Visualize the cluster boundaries. :param ax: The matplotlib axes on which to plot the cluster boundaries. :type ax: Axes :param colors: The colors to use for each cluster. :type colors: IndexableOrKeyable :param linewidth: The width of the boundary lines. :type linewidth: int, optional :rtype: None .. py:method:: visualize(X: numpy.ndarray, y: numpy.ndarray, ax: Optional[matplotlib.axes.Axes] = None, marker_size: int = 10, linewidth: int = 1, colors: Optional[artlib.common.utils.IndexableOrKeyable] = None) Visualize the clustering of the data with cluster boundaries. :param X: The dataset to visualize. :type X: np.ndarray :param y: The cluster labels for the data points. :type y: np.ndarray :param ax: The matplotlib axes on which to plot the visualization. :type ax: Axes, optional :param marker_size: The size of the data points in the plot. :type marker_size: int, optional :param linewidth: The width of the cluster boundary lines. :type linewidth: int, optional :param colors: The colors to use for each cluster. :type colors: IndexableOrKeyable, optional :rtype: None