artlib.topological.DualVigilanceART =================================== .. py:module:: artlib.topological.DualVigilanceART .. autoapi-nested-parse:: Dual Vigilance ART :cite:`da2019dual`. Classes ------- .. autoapisummary:: artlib.topological.DualVigilanceART.DualVigilanceART Module Contents --------------- .. py:class:: DualVigilanceART(base_module: artlib.common.BaseART.BaseART, rho_lower_bound: float) Bases: :py:obj:`artlib.common.BaseART.BaseART` Dual Vigilance ART for Clustering. This module implements Dual Vigilance ART as first published in: :cite:`da2019dual`. .. # Brito da Silva, L. E., Elnabarawy, I., & Wunsch II, D. C. (2019). .. # Dual vigilance fuzzy adaptive resonance theory. .. # Neural Networks, 109, 1–5. doi:10.1016/j.neunet.2018.09.015. Dual Vigilance ART allows a :class:`~artlib.common.BaseART.BaseART` module to cluster with both an upper and lower vigilance value. The upper-vigilance value allows the :class:`~artlib.common.BaseART.BaseART` module to cluster normally, however, data is simultaneously clustered using the lower vigilance level to combine multiple base ART categories into a single abstracted category. This permits clusters to be combined to form arbitrary shapes. For example if the :class:`~artlib.common.BaseART.BaseART` module is :class:`~artlib.elementary.FuzzyART.FuzzyART`, a Dual Vigilance Fuzzy ART clustering result would look like a series of hyper-boxes forming an arbitrary geometry. .. py:attribute:: base_module .. py:attribute:: rho_lower_bound .. py:attribute:: map :type: dict[int, int] .. py:method:: prepare_data(X: numpy.ndarray) -> numpy.ndarray Prepare data for clustering. :param X: The dataset. :type X: np.ndarray :returns: Prepared data from the base module. :rtype: np.ndarray .. py:method:: restore_data(X: numpy.ndarray) -> numpy.ndarray Restore data to its state prior to preparation. :param X: The dataset. :type X: np.ndarray :returns: Restored data from the base module. :rtype: np.ndarray .. py:method:: get_params(deep: bool = True) -> dict Get the parameters of the estimator. :param deep: If True, return the parameters for this class and contained subobjects that are estimators, by default True. :type deep: bool, optional :returns: Parameter names mapped to their values. :rtype: dict .. py:property:: n_clusters :type: int Get the current number of clusters. :returns: The number of clusters. :rtype: int .. py:property:: dim_ Get the dimensionality of the data from the base module. :returns: Dimensionality of the data. :rtype: int .. py:property:: labels_ Get the labels from the base module. :returns: Labels for the data. :rtype: np.ndarray .. py:property:: W :type: List Get the weights from the base module. :returns: Weights of the clusters. :rtype: list of np.ndarray .. py:method:: check_dimensions(X: numpy.ndarray) Check that the data has the correct dimensions. :param X: The dataset. :type X: np.ndarray .. py:method:: validate_data(X: numpy.ndarray) Validate the data prior to clustering. :param X: The dataset. :type X: np.ndarray .. py:method:: validate_params(params: dict) :staticmethod: Validate clustering parameters. :param params: Dictionary containing parameters for the algorithm. :type params: dict .. py:method:: _match_tracking(cache: Union[List[Dict], Dict], epsilon: float, params: Union[List[Dict], Dict], method: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~']) -> bool Adjust match tracking based on the method and epsilon value. :param cache: Cache containing intermediate results, including the match criterion. :type cache: dict :param epsilon: Adjustment factor for the match criterion. :type epsilon: float :param params: Dictionary containing algorithm parameters. :type params: dict :param method: Match tracking method to use. :type method: {"MT+", "MT-", "MT0", "MT1", "MT~"} :returns: True if match tracking continues, False otherwise. :rtype: bool .. py:method:: _set_params(new_params) .. py:method:: _deep_copy_params() -> dict .. py:method:: step_fit(x: numpy.ndarray, match_reset_func: Optional[Callable] = None, match_tracking: Literal['MT+', 'MT-', 'MT0', 'MT1', 'MT~'] = 'MT+', epsilon: float = 0.0) -> int Fit the model to a single sample. :param x: Data sample. :type x: np.ndarray :param match_reset_func: A callable accepting the data sample, a cluster weight, the params dict, and the cache dict. Returns True if the cluster is valid for the sample, False otherwise. :type match_reset_func: callable, optional :param match_tracking: Method for resetting match criterion, by default "MT+". :type match_tracking: {"MT+", "MT-", "MT0", "MT1", "MT~"}, optional :param epsilon: Epsilon value used for adjusting match criterion, by default 0.0. :type epsilon: float, optional :returns: Cluster label of the input sample. :rtype: int .. py:method:: step_pred(x) -> int Predict the label for a single sample. :param x: Data sample. :type x: np.ndarray :returns: Cluster label of the input sample. :rtype: int .. py:method:: get_cluster_centers() -> List[numpy.ndarray] Get the centers of each cluster, used for regression. :returns: Cluster centroids. :rtype: list of np.ndarray .. py:method:: plot_cluster_bounds(ax: matplotlib.axes.Axes, colors: artlib.common.utils.IndexableOrKeyable, linewidth: int = 1) Visualize the bounds of each cluster. :param ax: Figure axes. :type ax: matplotlib.axes.Axes :param colors: Colors to use for each cluster. :type colors: IndexableOrKeyable :param linewidth: Width of boundary line, by default 1. :type linewidth: int, optional