code: def feature_importances(
      data,
      top_n=None,
      feature_names=None,
      orientation="horizontal",
      ax=None,
  ):
      """
      Get and order feature importances from a scikit-learn model
      or from an array-like structure. If data is a scikit-learn model with
      sub-estimators (e.g. RandomForest, AdaBoost) the function will compute the
      standard deviation of each feature.
  
      Parameters
      ----------
      data : sklearn model or array-like structure
          Object to get the data from.
      top_n : int
          Only get results for the top_n features.
      feature_names : array-like
          Feature names
      orientation: ('horizontal', 'vertical')
          Bar plot orientation
      ax : matplotlib Axes
          Axes object to draw the plot onto, otherwise uses current Axes
  
      Returns
      -------
      ax: matplotlib Axes
          Axes containing the plot
  
      Examples
      --------
      .. plot:: ../examples/feature_importances.py
  
      """
      if data is None:
          raise ValueError(
              "data is needed to plot feature importances. "
              "When plotting using the evaluator you need to pass "
              "an estimator "
          )
  
      # If no feature_names is provided, assign numbers
      res = compute.feature_importances(data, top_n, feature_names)
  
      ax = bar.plot(
          res.importance,
          orientation,
          res.feature_name,
          error=None if not hasattr(res, "std_") else res.std_,
      )
      ax.set_title("Feature importances")
      return ax
  
imports: import json
  from pathlib import Path
  import numpy
  import matplotlib.pyplot
  from sklearn.metrics import confusion_matrix
  from sklearn_evaluation import __version__
  from ..telemetry import SKLearnEvaluationLogger
  from ..plot.matplotlib import bar
  from ..metrics import precision_at
  from ..None import compute
  from ..util import is_column_vector, is_row_vector, default_heatmap
  from sklearn_evaluation.plot.plot import AbstractPlot, AbstractComposedPlot
  from ..plot import _matrix
  from ploomber_core.exceptions import modify_exceptions
label_desc: Use image node_id 8 for calling a global function with example usage: feature_importances(data, top_n, feature_names, orientation, ax) and returns: ax