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
    ----------
    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

    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``
            'mutual_info-classification'], default: 'pearson'

    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.

    kwargs : dict
        Keyword arguments that are passed to the base class and may influence
        the visualization as defined in other Visualizers.

    Returns
    -------
    ax : matplotlib axes
        Returns the axes that the parallel coordinates were drawn on.

def feature_correlation(X, y, ax=None, method='pearson',
                        labels=None, sort=False, feature_index=None,
                        feature_names=None, **kwargs):
    """
    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
    ----------
    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

    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``
            'mutual_info-classification'], default: 'pearson'

    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.

    kwargs : dict
        Keyword arguments that are passed to the base class and may influence
        the visualization as defined in other Visualizers.

    Returns
    -------
    ax : matplotlib axes
        Returns the axes that the parallel coordinates were drawn on.
    """

    # Instantiate the visualizer
    viz = FeatureCorrelation(ax, method, labels, sort,
                             feature_index, feature_names, **kwargs)

    # Fit and transform the visualizer (calls draw)
    viz.fit(X, y, **kwargs)
    viz.finalize()

    # Return the axes object on the visualizer
    return viz.ax