original_docstring:  If x is continuous and y is discrete, compute mutual information
      
docstring: If x is continuous and y is discrete, compute mutual information
docstring_tokens: If x is continuous and y is discrete compute mutual information
code: def micd(x, y, k=3, base=2, warning=True):
      """ If x is continuous and y is discrete, compute mutual information
      """
      assert len(x) == len(y), "Arrays should have same length"
      entropy_x = entropy(x, k, base)
  
      y_unique, y_count = np.unique(y, return_counts=True, axis=0)
      y_proba = y_count / len(y)
  
      entropy_x_given_y = 0.
      for yval, py in zip(y_unique, y_proba):
          x_given_y = x[(y == yval).all(axis=1)]
          if k <= len(x_given_y) - 1:
              entropy_x_given_y += py * entropy(x_given_y, k, base)
          else:
              if warning:
                  warnings.warn("Warning, after conditioning, on y={yval} insufficient data. "
                                "Assuming maximal entropy in this case.".format(yval=yval))
              entropy_x_given_y += py * entropy_x
      return abs(entropy_x - entropy_x_given_y)
code_tokens: def micd ( x , y , k = 3 , base = 2 , warning = True ) : assert len ( x ) == len ( y ) , "Arrays should have same length" entropy_x = entropy ( x , k , base ) y_unique , y_count = np . unique ( y , return_counts = True , axis = 0 ) y_proba = y_count / len ( y ) entropy_x_given_y = 0. for yval , py in zip ( y_unique , y_proba ) : x_given_y = x [ ( y == yval ) . all ( axis = 1 ) ] if k <= len ( x_given_y ) - 1 : entropy_x_given_y += py * entropy ( x_given_y , k , base ) else : if warning : warnings . warn ( "Warning, after conditioning, on y={yval} insufficient data. " "Assuming maximal entropy in this case." . format ( yval = yval ) ) entropy_x_given_y += py * entropy_x return abs ( entropy_x - entropy_x_given_y )
short_docstring: If x is continuous and y is discrete, compute mutual information
short_docstring_tokens: If x is continuous and y is discrete compute mutual information
comment: """ If x is continuous and y is discrete, compute mutual information
      """