code: def test_custom_metrics(precalculated_rf_classifier_explainer):
      def meandiff_metric1(y_true, y_pred):
          return np.mean(y_true) - np.mean(y_pred)
  
      def meandiff_metric2(y_true, y_pred, cutoff):
          return np.mean(y_true) - np.mean(
              np.where(y_pred > cutoff, 1, 0)
          )
  
      def meandiff_metric3(y_true, y_pred, pos_label):
          return np.mean(np.where(y_true == pos_label, 1, 0)) - np.mean(
              y_pred[:, pos_label]
          )
  
      def meandiff_metric4(y_true, y_pred, cutoff, pos_label):
          return np.mean(np.where(y_true == pos_label, 1, 0)) - np.mean(
              np.where(y_pred[:, pos_label] > cutoff, 1, 0)
          )
  
      metrics = np.array(
          list(
              precalculated_rf_classifier_explainer.metrics(
                  show_metrics=[
                      meandiff_metric1,
                      meandiff_metric2,
                      meandiff_metric3,
                      meandiff_metric4,
                  ]
              ).values()
          )
      )
      assert np.all(metrics == metrics[0])
  
file_path: explainerdashboard/tests/test_classifier_explainer.py
imports: import pandas
  import numpy
  import plotly.graph_objects
label_desc: Use image node_id 2 for calling a global function with example usage: test_custom_metrics(precalculated_rf_classifier_explainer) and returns: unknown, unknown, unknown, unknown