code: def _plot_lda_classification(
      features,
      target,
      top_k_interactions,
      *,
      scatter_alpha="auto",
      scatter_size="auto",
      random_state=None,
  ):
      # assume features are scaled
      n_components = min(
          top_k_interactions,
          features.shape[0],
          features.shape[1],
          target.nunique() - 1,
      )
      lda = LinearDiscriminantAnalysis(n_components=n_components)
      features_lda = lda.fit_transform(features, target)
      # we should probably do macro-average recall here as everywhere else?
      print(
          "Linear Discriminant Analysis training set score: {:.3f}".format(
              recall_score(
                  target, lda.predict(features), average="macro"
              )
          )
      )
      if features_lda.shape[1] < 2:
          # Do a single plot and exit
          fig = plt.figure()
          single_lda = pd.DataFrame(
              {"feature": features_lda.ravel(), "target": target}
          )
          class_hists(single_lda, "feature", "target", legend=True)
          plt.title("Linear Discriminant")
          return fig
      feature_names = ["LDA {}".format(i) for i in range(n_components)]
  
      fig, _ = _plot_top_pairs(
          features_lda,
          target,
          scatter_alpha=scatter_alpha,
          scatter_size=scatter_size,
          feature_names=feature_names,
          random_state=random_state,
      )
      fig.suptitle("Discriminating LDA directions")
      return fig
  
imports: import warnings
  import numpy
  import matplotlib.pyplot
  import matplotlib
  import seaborn
  import pandas
  from sklearn.feature_selection import mutual_info_regression, mutual_info_classif, f_classif
  from sklearn.impute import SimpleImputer
  from sklearn.preprocessing import scale
  from sklearn.decomposition import PCA
  from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
  from sklearn.metrics import recall_score
  from ..preprocessing import detect_types, clean
  from .utils import _check_X_target_col, _get_n_top, _make_subplots, _short_tick_names, _shortname, _prune_category_make_X, find_pretty_grid, _find_scatter_plots_classification, class_hists, discrete_scatter, mosaic_plot, _find_inliers, pairplot, _get_scatter_alpha, _get_scatter_size, _find_categorical_for_regression, _prune_categories, _apply_eng_formatter
  from .sankey import plot_sankey
  from warnings import warn
label_desc: Use image node_id 5 for calling a global function with example usage: _plot_lda_classification(features, target, top_k_interactions) and returns: fig, fig