code: def mutualinfo_kde_2sample(y, x, normed=True):
      """mutual information of two random variables estimated with kde"""
      nobs = len(x)
      x = np.asarray(x, float)
      y = np.asarray(y, float)
      # yx = np.vstack((y,x))
      kde_x = gaussian_kde(x.T)(x.T)
      kde_y = gaussian_kde(y.T)(x.T)
      # kde_yx = gaussian_kde(yx)(yx)
  
      mi_obs = np.log(kde_x) - np.log(kde_y)
      if len(mi_obs) != nobs:
          raise ValueError("Wrong number of observations")
      mi = mi_obs.mean()
      if normed:
          mi_normed = np.sqrt(1.0 - np.exp(-2 * mi))
          return mi_normed
      else:
          return mi
  
imports: import numpy
  from scipy import stats
  from scipy.stats import gaussian_kde
  import statsmodels.sandbox.infotheo
label_desc: Use image node_id 2 for calling a global function with example usage: mutualinfo_kde_2sample(y, x, normed) and returns: mi_normed, mi