artlib.biclustering.BARTMAP =========================== .. py:module:: artlib.biclustering.BARTMAP .. autoapi-nested-parse:: BARTMAP :cite:`xu2011bartmap`, :cite:`xu2012biclustering`. Classes ------- .. autoapisummary:: artlib.biclustering.BARTMAP.BARTMAP Module Contents --------------- .. py:class:: BARTMAP(module_a: artlib.common.BaseART.BaseART, module_b: artlib.common.BaseART.BaseART, eta: float) Bases: :py:obj:`sklearn.base.BaseEstimator`, :py:obj:`sklearn.base.BiclusterMixin` BARTMAP for Biclustering. This class implements BARTMAP as first published in: :cite:`xu2011bartmap`. .. # Xu, R., & Wunsch II, D. C. (2011). .. # BARTMAP: A viable structure for biclustering. .. # Neural Networks, 24, 709–716. doi:10.1016/j.neunet.2011.03.020. BARTMAP accepts two instantiated :class:`~artlib.common.BaseART.BaseART` modules `module_a` and `module_b` which cluster the rows (samples) and columns (features) respectively. The features are clustered independently, but the samples are clustered by considering samples already within a row cluster as well as the candidate sample and enforcing a minimum correlation within the subset of features belonging to at least one of the feature clusters. .. py:attribute:: rows_ :type: numpy.ndarray .. py:attribute:: columns_ :type: numpy.ndarray .. py:attribute:: params .. py:attribute:: module_a .. py:attribute:: module_b .. py:method:: __getattr__(key) .. py:method:: __setattr__(key, value) .. py:method:: get_params(deep: bool = True) -> dict Get parameters for this estimator. :param deep: If True, return the parameters for this estimator and contained subobjects that are estimators. :type deep: bool, default=True :returns: Dictionary of parameter names mapped to their values. :rtype: dict .. py:method:: set_params(**params) Set the parameters of this estimator. Specific redefinition of `sklearn.BaseEstimator.set_params` for ART classes. :param \*\*params: Estimator parameters as keyword arguments. :type \*\*params: dict :returns: **self** -- The estimator instance. :rtype: object .. py:method:: validate_params(params: dict) :staticmethod: Validate clustering parameters. :param params: Dictionary containing parameters for the algorithm. :type params: dict .. py:property:: column_labels_ :type: numpy.ndarray Cluster labels for the columns. :returns: **column_labels_** -- Array of cluster labels assigned to each column. :rtype: ndarray of shape (n_columns,) .. py:property:: row_labels_ :type: numpy.ndarray Cluster labels for the rows. :returns: **row_labels_** -- Array of cluster labels assigned to each row. :rtype: ndarray of shape (n_rows,) .. py:property:: n_row_clusters :type: int Number of row clusters. :returns: **n_row_clusters** -- The number of clusters for the rows. :rtype: int .. py:property:: n_column_clusters :type: int Number of column clusters. :returns: **n_column_clusters** -- The number of clusters for the columns. :rtype: int .. py:method:: _get_x_cb(x: numpy.ndarray, c_b: int) Get the components of a vector belonging to a b-side cluster. :param x: A sample vector. :type x: np.ndarray :param c_b: The b-side cluster label. :type c_b: int :returns: The sample vector `x` filtered to include only features belonging to the b-side cluster `c_b`. :rtype: np.ndarray .. py:method:: _pearsonr(a: numpy.ndarray, b: numpy.ndarray) -> float :staticmethod: Get the Pearson correlation between two vectors. :param a: A vector. :type a: np.ndarray :param b: Another vector. :type b: np.ndarray :returns: The Pearson correlation between the two vectors `a` and `b`. :rtype: float .. py:method:: _average_pearson_corr(X: numpy.ndarray, k: int, c_b: int) -> float Get the average Pearson correlation for a sample across all features in cluster b. :param X: The dataset A. :type X: np.ndarray :param k: The sample index. :type k: int :param c_b: The b-side cluster to check. :type c_b: int :returns: The average Pearson correlation for the sample at index `k` across all features in cluster `c_b`. :rtype: float .. py:method:: validate_data(X_a: numpy.ndarray, X_b: numpy.ndarray) Validate the data prior to clustering. :param X_a: Dataset A, containing the samples. :type X_a: np.ndarray :param X_b: Dataset B, containing the features. :type X_b: np.ndarray .. py:method:: match_criterion_bin(X: numpy.ndarray, k: int, c_b: int, params: dict) -> bool Get the binary match criterion of the cluster. :param X: The dataset. :type X: np.ndarray :param k: The sample index. :type k: int :param c_b: The b-side cluster to check. :type c_b: int :param params: Dictionary containing parameters for the algorithm. :type params: dict :returns: Binary value indicating whether the cluster match criterion is met. :rtype: bool .. py:method:: match_reset_func(i: numpy.ndarray, w: numpy.ndarray, cluster_a, params: dict, extra: dict, cache: Optional[dict] = None) -> bool Permit external factors to influence cluster creation. :param i: Data sample. :type i: np.ndarray :param w: Cluster weight or information. :type w: np.ndarray :param cluster_a: A-side cluster label. :type cluster_a: int :param params: Dictionary containing parameters for the algorithm. :type params: dict :param extra: Additional parameters for the algorithm. :type extra: dict :param cache: Dictionary containing values cached from previous calculations. :type cache: dict, optional :returns: True if the match is permitted, otherwise False. :rtype: bool .. py:method:: step_fit(X: numpy.ndarray, k: int) -> int Fit the model to a single sample. :param X: The dataset. :type X: np.ndarray :param k: The sample index. :type k: int :returns: The cluster label of the input sample. :rtype: int .. py:method:: fit(X: numpy.ndarray, max_iter=1) Fit the model to the data. :param X: The dataset to fit the model on. :type X: np.ndarray :param max_iter: The number of iterations to fit the model on the same dataset. :type max_iter: int .. py:method:: visualize(cmap: Optional[matplotlib.colors.Colormap] = None) Visualize the clustering of the data. :param cmap: The colormap to use for visualization. :type cmap: matplotlib.colors.Colormap or str