code: def corr_X_y(
      X,
      y,
      top=5,
      figsize=(10, 8),
      fontsize=12,
      hspace=None,
      no_ticks=True,
      label_rotation=0,
      show=True,
  ):
      """Function for plotting input feature correlations with output.
  
      Output figure shows all correlations as well as top pos and neg.
  
      Parameters
      ----------
      X : pandas DataFrame of shape = [n_samples, n_features]
          Input data.
  
      y : pandas Series of shape = [n_samples,]
          training labels.
  
      top : int
          number of features to show in top pos and neg graphs.
  
      figsize : tuple (default = (10, 8))
          Size of figure.
  
      hspace : float, optional
          whitespace between top row of figures and bottom figure.
  
      fontsize : int
          font size of subplot titles.
  
      no_ticks : bool (default = False)
          whether to remove ticklabels from full correlation plot.
  
      label_rotation: float (default = 0)
          rotation of labels
  
      show : bool (default = True)
          whether to print figure using :obj:`matplotlib.pyplot.show`.
  
      Returns
      -------
      ax : object
          axis object.
      """
      if not X.__class__.__name__ == "DataFrame":
          raise ValueError("Expected 'X' to be pandas DataFrame.")
  
      # Prep pairwise correlations
      corr = X.apply(lambda x: pearsonr(x, y)[0]).sort_values(
          ascending=False
      )
  
      # Check that top selections will not be greater than all features
      n = len(corr)
      if top > n:
          top = n
  
      # Render figure
      names = corr.index.tolist()
      if hspace is None:
          hspace = 2 * fontsize / 100
      if label_rotation > abs(45):
          hspace += max([len(i) for i in names]) / 35 * (fontsize / 10)
  
      plt.figure(figsize=figsize)
      gs = GridSpec(2, 2, hspace=hspace)
  
      # Axes
      ax0 = plt.subplot(gs[0, 0])
      ax0.bar(range(top), corr.iloc[:top], align="center")
      ax0.axhline(0, color="black", linewidth=0.5)
      ax0.set_title(
          "Top %i positive pairwise correlation coefficients" % top,
          fontsize=fontsize,
      )
      plt.xticks(
          range(top),
          names[:top],
          rotation=label_rotation,
          fontsize=fontsize - 1,
      )
  
      ax1 = plt.subplot(gs[0, 1])
      ax1.bar(range(top), corr.iloc[-top:], align="center")
      ax1.axhline(0, color="black", linewidth=0.5)
      ax1.set_title(
          "Top %i negative pairwise correlation coefficients" % top,
          fontsize=fontsize,
      )
      plt.xticks(
          range(top),
          names[-top:],
          rotation=label_rotation,
          fontsize=fontsize - 1,
      )
  
      ax2 = plt.subplot(gs[1, :])
      ax2.bar(range(len(corr)), corr, align="center")
      ax2.axhline(0, color="black", linewidth=0.5)
      ax2.set_title(
          "All pairwise correlation coefficients", fontsize=fontsize
      )
  
      if no_ticks:
          ax2.set_xticks([], [])
      else:
          plt.xticks(
              range(len(names)),
              names,
              rotation=label_rotation,
              fontsize=fontsize - 1,
          )
  
      if show:
          plt.show()
  
      return gs
  
imports: from __future__ import division, print_function
  import numpy
  from scipy.stats import pearsonr
  import warnings
label_desc: Use image node_id 3 for calling a global function with example usage: corr_X_y(X, y, top, figsize, fontsize, hspace, no_ticks, label_rotation, show) and returns: gs