class_docstr: Class Feature Interpreter.
  
  The class is used to generate the following information:
      - feature distribution
      - feature correlation
      - feature importance ranking for a trained model
docstr: Get feature correlation
  
  Args:
      feature_types: list, the pre-defined data type for each feature
      train_x: numpy.ndarray, training data
      categorical_corr_type: str, pre-defined correlation type for correlation among categorical features.
      numerical_corr_type: str, pre-defined correlation type for correlation among numerical features.
      text_corr_type: str, pre-defined correlation type for correlation among text features.
      categorical_vs_numerical_corr_type: str, pre-defined correlation type for correlation between categorical
                                          features and numerical features.
  
  Returns:
      Dataframe of correlation type mask,
      Dataframe of correlation values
docstr_tok: ["Get","feature","correlation","Args",":","feature_types",":","list",",","the","pre-defined","data","type","for","each","feature","train_x",":","numpy.ndarray",",","training","data","categorical_corr_type",":","str",",","pre-defined","correlation","type","for","correlation","among","categorical","features",".","numerical_corr_type",":","str",",","pre-defined","correlation","type","for","correlation","among","numerical","features",".","text_corr_type",":","str",",","pre-defined","correlation","type","for","correlation","among","text","features",".","categorical_vs_numerical_corr_type",":","str",",","pre-defined","correlation","type","for","correlation","between","categorical","features","and","numerical","features",".","Returns",":","Dataframe","of","correlation","type","mask",",","Dataframe","of","correlation","values"]
code: def get_feature_correlation(
      self,
      feature_types: List[str],
      train_x: numpy.ndarray,
      categorical_corr_type="lambda",
      numerical_corr_type="pearson",
      text_corr_type="tf",
      categorical_vs_numerical_corr_type="anova",
  ) -> (pd.DataFrame, pd.DataFrame):
      """
      Get feature correlation
  
      Args:
          feature_types: list, the pre-defined data type for each feature
          train_x: numpy.ndarray, training data
          categorical_corr_type: str, pre-defined correlation type for correlation among categorical features.
          numerical_corr_type: str, pre-defined correlation type for correlation among numerical features.
          text_corr_type: str, pre-defined correlation type for correlation among text features.
          categorical_vs_numerical_corr_type: str, pre-defined correlation type for correlation between categorical
                                              features and numerical features.
  
      Returns:
          Dataframe of correlation type mask,
          Dataframe of correlation values
  
      """
      if len(feature_types) != len(self._feature_names):
          raise InconsistentSize(
              "feature_types",
              "feature_names",
              len(feature_types),
              len(self._feature_names),
          )
  
      if train_x.shape[1] != len(self._feature_names):
          raise InconsistentSize(
              "train_x.shape[1]",
              "feature_types",
              train_x.shape[1],
              len(self._feature_names),
          )
  
      df = pd.DataFrame(data=train_x, columns=self._feature_names)
  
      feature_name_to_type = {
          key: value
          for key, value in list(
              zip(self._feature_names, feature_types)
          )
      }
      categorical_feature = [
          name
          for name, type in feature_name_to_type.items()
          if type == DATATYPE.CATEGORY
      ]
      numeric_feature = [
          name
          for name, type in feature_name_to_type.items()
          if type == DATATYPE.NUMBER
      ]
      text_feature = [
          name
          for name, type in feature_name_to_type.items()
          if type == DATATYPE.FREETEXT
      ]
  
      overall_corr = dict()
  
      corr = self._get_categorical_correlation(
          df,
          categorical_feature,
          correlation_type=categorical_corr_type,
      )
      overall_corr.update(corr)
  
      corr = self._get_numerical_correlation(
          df, numeric_feature, correlation_type=numerical_corr_type
      )
      overall_corr.update(corr)
  
      corr = self._get_text_correlation(
          df, text_feature, correlation_type=text_corr_type
      )
      overall_corr.update(corr)
  
      corr = self._get_categorical_vs_numerical_correlation(
          df,
          categorical_feature,
          numeric_feature,
          correlation_type=categorical_vs_numerical_corr_type,
      )
      overall_corr.update(corr)
  
      correlation_values = pd.DataFrame(
          numpy.zeros((len(feature_types), len(feature_types))),
          columns=self._feature_names,
          index=self._feature_names,
      )
      correlation_types = pd.DataFrame(
          numpy.zeros((len(feature_types), len(feature_types))),
          columns=self._feature_names,
          index=self._feature_names,
      )
      for (col1, col2), (method, value) in overall_corr.items():
          correlation_values[col1][col2] = value
          correlation_types[col1][col2] = method
  
      return correlation_types, correlation_values
  
imports: import operator
  import warnings
  import numpy
  import pandas
  from scipy import stats
  from typing import List, Dict, Tuple
  import shap
  from xai import ALG, MODE
  from xai.data.constants import DATATYPE
  from xai.data.explorer.data_analyzer_suite import DataAnalyzerSuite
  from xai.model.interpreter.exceptions import InconsistentSize, TrainingDataNotProvided
  from xai.model.interpreter.exceptions import UnsupportedMethodType
label_desc: Use image node_id 3 for calling the FeatureInterpreter obj's underlying member method code with example usage: obj.get_feature_correlation(feature_types, train_x, categorical_corr_type, numerical_corr_type, text_corr_type, categorical_vs_numerical_corr_type) and returns: correlation_types,  correlation_values