class_docstr: Displays the correlation between features and dependent variables.
  
  This visualizer can be used side-by-side with
  ``yellowbrick.features.JointPlotVisualizer`` that plots a feature
  against the target and shows the distribution of each via a
  histogram on each axis.
  
  Parameters
  ----------
  ax : matplotlib Axes, default: None
      The axis to plot the figure on. If None is passed in the current axes
      will be used (or generated if required).
  
  method : str, default: 'pearson'
      The method to calculate correlation between features and target.
      Options include:
  
          - 'pearson', which uses ``scipy.stats.pearsonr``
          - 'mutual_info-regression', which uses ``mutual_info-regression``
            from ``sklearn.feature_selection``
          - 'mutual_info-classification', which uses ``mutual_info_classif``
            from ``sklearn.feature_selection``
  
  labels : list, default: None
      A list of feature names to use. If a DataFrame is passed to fit and
      features is None, feature names are selected as the column names.
  
  sort : boolean, default: False
      If false, the features are are not sorted in the plot; otherwise
      features are sorted in ascending order of correlation.
  
  feature_index : list,
      A list of feature index to include in the plot.
  
  feature_names : list of feature names
      A list of feature names to include in the plot.
      Must have labels or the fitted data is a DataFrame with column names.
      If feature_index is provided, feature_names will be ignored.
  
  color: string
      Specify color for barchart
  
  kwargs : dict
      Keyword arguments that are passed to the base class and may influence
      the visualization as defined in other Visualizers.
  
  Attributes
  ----------
  features_ : np.array
      The feature labels
  
  scores_ : np.array
      Correlation between features and dependent variable.
  
  Examples
  --------
  
  >>> viz = FeatureCorrelation()
  >>> viz.fit(X, y)
  >>> viz.show()
docstr: Fits the estimator to calculate feature correlation to
  dependent variable.
  
  Parameters
  ----------
  X : ndarray or DataFrame of shape n x m
      A matrix of n instances with m features
  
  y : ndarray or Series of length n
      An array or series of target or class values
  
  kwargs : dict
      Keyword arguments passed to the fit method of the estimator.
  
  Returns
  -------
  self : visualizer
      The fit method must always return self to support pipelines.
docstr_tok: ["Fits","the","estimator","to","calculate","feature","correlation","to","dependent","variable",".","Parameters","--","--","--","--","--","X",":","ndarray","or","DataFrame","of","shape","n","x","m","A","matrix","of","n","instances","with","m","features","y",":","ndarray","or","Series","of","length","n","An","array","or","series","of","target","or","class","values","kwargs",":","dict","Keyword","arguments","passed","to","the","fit","method","of","the","estimator",".","Returns","--","--","--","-","self",":","visualizer","The","fit","method","must","always","return","self","to","support","pipelines","."]
code: def fit(self, X, y, **kwargs):
      """
      Fits the estimator to calculate feature correlation to
      dependent variable.
  
      Parameters
      ----------
      X : ndarray or DataFrame of shape n x m
          A matrix of n instances with m features
  
      y : ndarray or Series of length n
          An array or series of target or class values
  
      kwargs : dict
          Keyword arguments passed to the fit method of the estimator.
  
      Returns
      -------
      self : visualizer
          The fit method must always return self to support pipelines.
      """
      self._create_labels_for_features(X)
  
      self._select_features_to_plot(X)
  
      # Calculate Features correlation with target variable
      if self.method == "pearson":
          self.scores_ = np.array(
              [pearsonr(x, y, **kwargs)[0] for x in np.asarray(X).T]
          )
      else:
          self.scores_ = np.array(
              self.correlation_methods[self.method](X, y, **kwargs)
          )
  
      # If feature indices are given, plot only the given features
      if self.feature_index:
          self.scores_ = self.scores_[self.feature_index]
          self.features_ = self.features_[self.feature_index]
  
      # Sort features by correlation
      if self.sort:
          sort_idx = np.argsort(self.scores_)
          self.scores_ = self.scores_[sort_idx]
          self.features_ = self.features_[sort_idx]
  
      self.draw()
      return self
  
file_path: yellowbrick/yellowbrick/target/feature_correlation.py
imports: import numpy
  from yellowbrick.utils import is_dataframe
  from yellowbrick.target.base import TargetVisualizer
  from yellowbrick.exceptions import YellowbrickValueError, YellowbrickWarning
  from sklearn.feature_selection import mutual_info_classif
  from sklearn.feature_selection import mutual_info_regression
  from scipy.stats import pearsonr
label_desc: Use image node_id 2 for calling the FeatureCorrelation obj's underlying member method code with example usage: obj.fit(X, y) and returns: self