data_describe.core.correlation ===================================== .. py:module:: data_describe.core.correlation .. autoapisummary:: data_describe.core.correlation.correlation_matrix .. py:class:: CorrelationWidget(association_matrix=None, cluster_matrix=None, categorical=None, viz_data=None, **kwargs) Bases: :class:`data_describe._widget.BaseWidget` Container for correlation calculation and visualization. This class (object) is returned from the ``correlation_matrix`` function. The attributes documented below can be accessed or extracted. .. attribute:: association_matrix The combined association matrix i.e. correlation and other categorical-numeric or categorical-categorical associations. .. attribute:: cluster_matrix The clustered association matrix. .. attribute:: categorical True if association matrix contains categorical values. :type: bool .. attribute:: viz_data The final data to be visualized. .. method:: show(self, viz_backend=None, **kwargs) The default display for this output. Displays the correlation matrix heatmap. :param viz_backend: The visualization backend. :param \*\*kwargs: Keyword arguments. :raises ValueError: Computed data is missing. :returns: The correlation matrix plot. .. function:: correlation_matrix(data, cluster=False, categorical=False, compute_backend=None, viz_backend=None, **kwargs) -> CorrelationWidget Computes correlations (associations) and visualizes as a heatmap. This feature combines measures of association for pairs of variables: * Numeric-numeric pairs: Pearson correlation * Categorical-numeric pairs: Correlation ratio * Categorical-categorical pairs * More than 2 levels: Cramer's V * Only 2 levels for both variables: Point-biserial coefficient :param data: A data frame :type data: DataFrame :param cluster: If True, use clustering to reorder similar columns together :type cluster: bool :param categorical: If True, include categorical associations using Cramer's V, Correlation Ratio, and Point-biserial coefficient (a.k.a. Matthews correlation coefficient). All associations (including Pearson correlation) are scaled to be in the range [0, 1]. :type categorical: bool :param compute_backend: The compute backend. :param viz_backend: The visualization backend. :param \*\*kwargs: Keyword arguments. :raises ValueError: Invalid data input type. :returns: CorrelationWidget