code: def theil_u_correlation(
      x: Union[List, np.ndarray, pd.Series],
      y: Union[List, np.ndarray, pd.Series],
  ) -> float:
      """
      Calculate the Theil's U correlation of y to x.
  
      Theil's U is an asymmetric measure ranges [0,1] based on entropy which answers the question: how well does
      variable y explains variable x? For more information see https://en.wikipedia.org/wiki/Uncertainty_coefficient
  
      Parameters
      ----------
      x: Union[List, np.ndarray, pd.Series]
          A sequence of a categorical variable values without nulls
      y: Union[List, np.ndarray, pd.Series]
          A sequence of a categorical variable values without nulls
  
      Returns
      -------
      float
          Representing the Theil U correlation between y and x
      """
      s_xy = conditional_entropy(x, y)
      values_probabilities = value_frequency(x)
      s_x = entropy(values_probabilities)
      if s_x == 0:
          return 1
      else:
          return (s_x - s_xy) / s_x
  
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 2 for calling a global function with example usage: theil_u_correlation(x, y) and returns: int, unknown