artlib.elementary.BayesianART ============================= .. py:module:: artlib.elementary.BayesianART .. autoapi-nested-parse:: Bayesian ART :cite:`vigdor2007bayesian`. Classes ------- .. autoapisummary:: artlib.elementary.BayesianART.BayesianART Module Contents --------------- .. py:class:: BayesianART(rho: float, cov_init: numpy.ndarray) Bases: :py:obj:`artlib.common.BaseART.BaseART` Bayesian ART for Clustering. This module implements Bayesian ART as first published in: :cite:`vigdor2007bayesian`. .. # Vigdor, B., & Lerner, B. (2007). .. # The Bayesian ARTMAP. .. # IEEE Transactions on Neural .. # Networks, 18, 1628–1644. doi:10.1109/TNN.2007.900234. Bayesian ART clusters data in Bayesian Distributions (Hyper-ellipsoids) and is similar to :class:`~artlib.elementary.GaussianART.GaussianART` but differs in that it allows arbitrary rotation of the hyper-ellipsoid. .. py:attribute:: pi2 .. py:method:: validate_params(params: dict) :staticmethod: Validate clustering parameters. :param params: Dictionary containing parameters for the algorithm. :type params: dict .. 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:: category_choice(i: numpy.ndarray, w: numpy.ndarray, params: dict) -> tuple[float, Optional[dict]] Get the activation of the cluster. :param i: Data sample. :type i: np.ndarray :param w: Cluster weight or information. :type w: np.ndarray :param params: Dictionary containing parameters for the algorithm. :type params: dict :returns: * *float* -- Cluster activation. * *dict, optional* -- Cache used for later processing. .. py:method:: match_criterion(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: Optional[dict] = None) -> Tuple[float, Optional[Dict]] Get the match criterion of the cluster. :param i: Data sample. :type i: np.ndarray :param w: Cluster weight or information. :type w: np.ndarray :param params: Dictionary containing parameters for the algorithm. :type params: dict :param cache: Cache containing values from previous calculations. :type cache: dict, optional :returns: * *float* -- Cluster match criterion. * *dict* -- Cache used for later processing. .. py:method:: match_criterion_bin(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: Optional[dict] = None, op: Callable = operator.ge) -> tuple[bool, dict] Get the binary match criterion of the cluster. :param i: Data sample. :type i: np.ndarray :param w: Cluster weight or information. :type w: np.ndarray :param params: Dictionary containing parameters for the algorithm. :type params: dict :param cache: Cache containing values from previous calculations. :type cache: dict, optional :param op: Operator for comparison, by default operator.ge. :type op: callable, optional :returns: * *bool* -- Binary match criterion. * *dict* -- Cache used for later processing. .. 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:: update(i: numpy.ndarray, w: numpy.ndarray, params: dict, cache: Optional[dict] = None) -> numpy.ndarray Get the updated cluster weight. :param i: Data sample. :type i: np.ndarray :param w: Cluster weight or information. :type w: np.ndarray :param params: Dictionary containing parameters for the algorithm. :type params: dict :param cache: Cache containing values from previous calculations. :type cache: dict, optional :returns: Updated cluster weight. :rtype: np.ndarray .. py:method:: new_weight(i: numpy.ndarray, params: dict) -> numpy.ndarray Generate a new cluster weight. :param i: Data sample. :type i: np.ndarray :param params: Dictionary containing parameters for the algorithm. :type params: dict :returns: Updated cluster weight. :rtype: np.ndarray .. 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: Iterable, 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