code: def is_prediction_flip(
      cf_output: types.JsonDict,
      orig_output: types.JsonDict,
      output_spec: types.JsonDict,
      pred_key: str,
      regression_thresh: Optional[float] = None,
  ) -> bool:
      """Check if cf_output and  orig_output specify different prediciton classes."""
      if isinstance(output_spec[pred_key], types.RegressionScore):
          # regression model. We use the provided threshold to binarize the output.
          cf_pred_class = cf_output[pred_key] <= regression_thresh
          orig_pred_class = orig_output[pred_key] <= regression_thresh
      else:
          cf_pred_class = np.argmax(cf_output[pred_key])
          orig_pred_class = np.argmax(orig_output[pred_key])
      return cf_pred_class != orig_pred_class
  
file_path: lit/lit_nlp/components/cf_utils.py
imports: import re
  from typing import Any, Optional, cast
  from lit_nlp.api import types
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: is_prediction_flip(cf_output, orig_output, output_spec, pred_key, regression_thresh) and returns: unknown