code: def correlation_ratio(
      categorical_data: Union[List, np.ndarray, pd.Series],
      numerical_data: Union[List, np.ndarray, pd.Series],
      ignore_mask: Union[List[bool], np.ndarray] = None,
  ) -> float:
      """
      Calculate the correlation ratio of numerical_variable to categorical_variable.
  
      Correlation ratio is a symmetric grouping based method that describe the level of correlation between
      a numeric variable and a categorical variable. returns a value in [0,1].
      For more information see https://en.wikipedia.org/wiki/Correlation_ratio
  
      Parameters
      ----------
      categorical_data: Union[List, np.ndarray, pd.Series]
          A sequence of categorical values encoded as class indices without nulls except possibly at ignored elements
      numerical_data: Union[List, np.ndarray, pd.Series]
          A sequence of numerical values without nulls except possibly at ignored elements
      ignore_mask: Union[List[bool], np.ndarray[bool]] default: None
          A sequence of boolean values indicating which elements to ignore. If None, includes all indexes.
  
      Returns
      -------
      float
          Representing the correlation ratio between the variables.
      """
      if ignore_mask:
          numerical_data = numerical_data[~np.asarray(ignore_mask)]
          categorical_data = categorical_data[~np.asarray(ignore_mask)]
  
      cat_num = int(np.max(categorical_data) + 1)
      y_avg_array = np.zeros(cat_num)
      n_array = np.zeros(cat_num)
      for i in range(cat_num):
          cat_measures = numerical_data[categorical_data == i]
          n_array[i] = cat_measures.shape[0]
          y_avg_array[i] = np.average(
              cat_measures.astype(float)
          )  # Cast to float to avoid error in python 3.6
      y_total_avg = np.sum(np.multiply(y_avg_array, n_array)) / np.sum(
          n_array
      )
      numerator = np.sum(
          np.multiply(
              n_array,
              np.power(np.subtract(y_avg_array, y_total_avg), 2),
          )
      )
      denominator = np.sum(
          np.power(np.subtract(numerical_data, y_total_avg), 2)
      )
      if denominator == 0:
          eta = 0
      else:
          eta = np.sqrt(numerator / denominator)
      return eta
  
file_path: deepchecks/deepchecks/utils/correlation_methods.py
imports: import math
  from collections import Counter
  from typing import List, Union
  import numpy
  import pandas
  from scipy.stats import entropy
  from deepchecks.utils.distribution.preprocessing import value_frequency
label_desc: Use image node_id 4 for calling a global function with example usage: correlation_ratio(categorical_data, numerical_data, ignore_mask) and returns: eta