code: def plot_feature_outlier_tabular(
      od_preds: Dict,
      X: np.ndarray,
      X_recon: np.ndarray = None,
      threshold: float = None,
      instance_ids: list = None,
      max_instances: int = 5,
      top_n: int = int(1e12),
      outliers_only: bool = False,
      feature_names: list = None,
      width: float = 0.2,
      figsize: tuple = (20, 10),
  ) -> None:
      """
      Plot feature wise outlier scores for tabular data.
  
      Parameters
      ----------
      od_preds
          Output of an outlier detector's prediction.
      X
          Batch of instances to apply outlier detection to.
      X_recon
          Reconstructed instances of X.
      threshold
          Threshold used for outlier score to determine outliers.
      instance_ids
          List with indices of instances to display.
      max_instances
          Maximum number of instances to display.
      top_n
          Maixmum number of features to display, ordered by outlier score.
      outliers_only
          Whether to only show outliers or not.
      feature_names
          List with feature names.
      width
          Column width for bar charts.
      figsize
          Tuple for the figure size.
      """
      if outliers_only and instance_ids is None:
          instance_ids = list(
              np.where(od_preds["data"]["is_outlier"])[0]
          )
      elif instance_ids is None:
          instance_ids = list(
              range(len(od_preds["data"]["is_outlier"]))
          )
      n_instances = min(max_instances, len(instance_ids))
      instance_ids = instance_ids[:n_instances]
      n_features = X.shape[1]
      n_cols = 2
  
      labels_values = ["Original"]
      if X_recon is not None:
          labels_values += ["Reconstructed"]
      labels_scores = ["Outlier Score"]
      if threshold is not None:
          labels_scores = ["Threshold"] + labels_scores
  
      fig, axes = plt.subplots(
          nrows=n_instances, ncols=n_cols, figsize=figsize
      )
  
      n_subplot = 1
      for i in range(n_instances):
          idx = instance_ids[i]
  
          fscore = od_preds["data"]["feature_score"][idx]
          if top_n >= n_features:
              keep_cols = np.arange(n_features)
          else:
              keep_cols = np.argsort(fscore)[::-1][:top_n]
          fscore = fscore[keep_cols]
          X_idx = X[idx][keep_cols]
          ticks = np.arange(len(keep_cols))
  
          plt.subplot(n_instances, n_cols, n_subplot)
          if X_recon is not None:
              X_recon_idx = X_recon[idx][keep_cols]
              plt.bar(
                  ticks - width,
                  X_idx,
                  width=width,
                  color="b",
                  align="center",
              )
              plt.bar(
                  ticks,
                  X_recon_idx,
                  width=width,
                  color="g",
                  align="center",
              )
          else:
              plt.bar(
                  ticks, X_idx, width=width, color="b", align="center"
              )
          if feature_names is not None:
              plt.xticks(
                  ticks=ticks,
                  labels=list(np.array(feature_names)[keep_cols]),
                  rotation=45,
              )
          plt.title("Feature Values")
          plt.xlabel("Features")
          plt.ylabel("Feature Values")
          plt.legend(labels_values)
          n_subplot += 1
  
          plt.subplot(n_instances, n_cols, n_subplot)
          plt.bar(ticks, fscore)
          if threshold is not None:
              plt.plot(np.ones(len(ticks)) * threshold, "r")
          if feature_names is not None:
              plt.xticks(
                  ticks=ticks,
                  labels=list(np.array(feature_names)[keep_cols]),
                  rotation=45,
              )
          plt.title("Feature Level Outlier Score")
          plt.xlabel("Features")
          plt.ylabel("Outlier Score")
          plt.legend(labels_scores)
          n_subplot += 1
  
      plt.tight_layout()
      plt.show()
  
file_path: alibi-detect/alibi_detect/utils/visualize.py
imports: import matplotlib.pyplot
  import numpy
  import pandas
  from sklearn.metrics import roc_curve, auc
  from typing import Dict, Union
  import warnings
label_desc: Use image node_id 3 for calling a global function with example usage: plot_feature_outlier_tabular(od_preds, X, X_recon, threshold, instance_ids, max_instances, top_n, outliers_only, feature_names, width, figsize) without return types