class_docstr: Correlation analysis.
  
  Note: it is recommended to apply AutoGluon standard pre-processing - this will allow to include categorical variables into the analysis.
  This can be done via wrapping analysis into :py:class:`~autogluon.eda.analysis.transform.ApplyFeatureGenerator`
  
  
  Parameters
  ----------
  method: str  {'pearson', 'kendall', 'spearman', 'phik'}, default='spearman'
      Method of correlation:
          * pearson : standard correlation coefficient
          * kendall : Kendall Tau correlation coefficient
          * spearman : Spearman rank correlation
          * phik : phi_k correlation
              Correlation matrix of bivariate gaussian derived from chi2-value Chi2-value
              gets converted into correlation coefficient of bivariate gauss with correlation
              value rho, assuming given binning and number of records. Correlation coefficient
              value is between 0 and 1. Bivariate gaussian's range is set to [-5,5] by construction.
              See Also `phik <https://github.com/KaveIO/PhiK>`_ documentation.
  
  focus_field: Optional[str], default = None
      field name to focus. Specifying a field would filter all correlations only when they are >= `focus_field_threshold`
      This is helpful when dealing with a large number of variables.
  focus_field_threshold: float, default = 0.5
      a cut-off threshold when `focus_field` is specified
  parent: Optional[AbstractAnalysis], default = None
      parent Analysis
  children: List[AbstractAnalysis], default = []
      wrapped analyses; these will receive sampled `args` during `fit` call
  
  Examples
  --------
  >>> import autogluon.eda.analysis as eda
  >>> import autogluon.eda.visualization as viz
  >>> import autogluon.eda.auto as auto
  >>> import pandas as pd
  >>> import numpy as np
  >>> df_train = pd.DataFrame(...)
  >>>
  >>> auto.analyze(return_sttrain_data=df_train, label=target_col, anlz_facets=[
  >>>     # Apply standard AutoGluon pre-processing to transform categorical variables to numbers to ensure correlation includes them.
  >>>     eda.transform.ApplyFeatureGenerator(category_to_numbers=True, children=[
  >>>         # We use `spearman` correlation to capture non-linear interactions because it is based on the order rank.
  >>>         eda.interaction.Correlation(method='spearman', focus_field=target_col, focus_field_threshold=0.3),
  >>>     ])
  >>> ], viz_facets=[
  >>>     viz.interaction.CorrelationVisualization(fig_args=dict(figsize=(12,8)), **common_args),
  >>> ])
  
  See Also
  --------
  :py:class:`~autogluon.eda.analysis.transform.ApplyFeatureGenerator`
class_docstr_tok: ["Correlation","analysis",".","Note",":","it","is","recommended","to","apply","AutoGluon","standard","pre-processing","-","this","will","allow","to","include","categorical","variables","into","the","analysis",".","This","can","be","done","via","wrapping","analysis","into",":","py",":","class",":","`","~autogluon.eda.analysis.transform.ApplyFeatureGenerator","`","Parameters","--","--","--","--","--","method",":","str","{","'pearson","'",",","'kendall","'",",","'spearman","'",",","'phik","'","}",",","default='spearman'","Method","of","correlation",":","*","pearson",":","standard","correlation","coefficient","*","kendall",":","Kendall","Tau","correlation","coefficient","*","spearman",":","Spearman","rank","correlation","*","phik",":","phi_k","correlation","Correlation","matrix","of","bivariate","gaussian","derived","from","chi2-value","Chi2-value","gets","converted","into","correlation","coefficient","of","bivariate","gauss","with","correlation","value","rho",",","assuming","given","binning","and","number","of","records",".","Correlation","coefficient","value","is","between","0","and","1",".","Bivariate","gaussian","'s","range","is","set","to","[","-5,5","]","by","construction",".","See","Also","`","phik","<","https",":","\/\/github.com\/KaveIO\/PhiK",">","`","_","documentation",".","focus_field",":","Optional","[","str","]",",","default","=","None","field","name","to","focus",".","Specifying","a","field","would","filter","all","correlations","only","when","they","are",">","=","`","focus_field_threshold","`","This","is","helpful","when","dealing","with","a","large","number","of","variables",".","focus_field_threshold",":","float",",","default","=","0.5","a","cut-off","threshold","when","`","focus_field","`","is","specified","parent",":","Optional","[","AbstractAnalysis","]",",","default","=","None","parent","Analysis","children",":","List","[","AbstractAnalysis","]",",","default","=","[","]","wrapped","analyses",";","these","will","receive","sampled","`","args","`","during","`","fit","`","call","Examples","--","--","--","--",">",">",">","import","autogluon.eda.analysis","as","eda",">",">",">","import","autogluon.eda.visualization","as","viz",">",">",">","import","autogluon.eda.auto","as","auto",">",">",">","import","pandas","as","pd",">",">",">","import","numpy","as","np",">",">",">","df_train","=","pd.DataFrame","(","...",")",">",">",">",">",">",">","auto.analyze","(","return_sttrain_data=df_train",",","label=target_col",",","anlz_facets=","[",">",">",">","#","Apply","standard","AutoGluon","pre-processing","to","transform","categorical","variables","to","numbers","to","ensure","correlation","includes","them",".",">",">",">","eda.transform.ApplyFeatureGenerator","(","category_to_numbers=True",",","children=","[",">",">",">","#","We","use","`","spearman","`","correlation","to","capture","non-linear","interactions","because","it","is","based","on","the","order","rank",".",">",">",">","eda.interaction.Correlation","(","method='spearman","'",",","focus_field=target_col",",","focus_field_threshold=0.3",")",",",">",">",">","]",")",">",">",">","]",",","viz_facets=","[",">",">",">","viz.interaction.CorrelationVisualization","(","fig_args=dict","(","figsize=","(","12,8",")",")",",","*","*","common_args",")",",",">",">",">","]",")","See","Also","--","--","--","--",":","py",":","class",":","`","~autogluon.eda.analysis.transform.ApplyFeatureGenerator","`"]
code: def __init__(
      self,
      method: str = "spearman",
      focus_field: Optional[str] = None,
      focus_field_threshold: float = 0.5,
      parent: Optional[AbstractAnalysis] = None,
      children: Optional[List[AbstractAnalysis]] = None,
      **kwargs,
  ) -> None:
      super().__init__(parent, children, **kwargs)
      assert method in ["pearson", "kendall", "spearman", "phik"]
      self.method = method
      self.focus_field = focus_field
      self.focus_field_threshold = focus_field_threshold
  
imports: import warnings
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  import phik
  from pandas.core.dtypes.common import is_numeric_dtype
  from scipy import stats
  from scipy.cluster import hierarchy
  from scipy.stats import spearmanr
  from ..None import AnalysisState
  from .base import AbstractAnalysis
  from autogluon.common.features.types import R_FLOAT, R_INT
label_desc: Use image node_id 1 to create a new Correlation object from inherited base classes: AbstractAnalysis with example: obj = Correlation(method, focus_field, focus_field_threshold, parent, children)