code: def test_pipeline(pipeline, X, y, binary, **kwargs):
      if binary:
          get_metrics = get_metrics_binary
      else:
          get_metrics = get_metrics_multiclass
  
      # run the test data through the trained pipeline
      y_pred = pipeline.predict(X)
  
      # if necessary (i.e. if a pipeline does not produce probability scores by
      # default), use class distance scores in lieu of probability scores
      method = pipeline.steps[-1][0]
      if method in ["sgd", "pa"]:
          if binary:
              class_1_distance = pipeline.decision_function(X)
              class_0_distance = -class_1_distance
              y_pred_probs = np.column_stack(
                  (class_0_distance, class_1_distance)
              )
          else:
              y_pred_probs = pipeline.decision_function(X)
      else:
          y_pred_probs = pipeline.predict_proba(X)
  
      return get_metrics(y, y_pred, y_pred_probs, **kwargs)
  
file_path: ATM/atm/metrics.py
imports: from __future__ import absolute_import, division, unicode_literals
  from builtins import range
  import numpy
  import pandas
  from sklearn.metrics import accuracy_score, average_precision_score, cohen_kappa_score, f1_score, matthews_corrcoef, precision_recall_curve, roc_auc_score, roc_curve
  from sklearn.model_selection import StratifiedKFold
  from atm.constants import METRICS_BINARY, METRICS_MULTICLASS, N_FOLDS_DEFAULT, Metrics
label_desc: Use image node_id 6 for calling a global function with example usage: test_pipeline(pipeline, X, y, binary) and returns: get_metrics