docstr: Parameters
  ----------
  X
      Instance to encode and calculate distance metrics for.
  adv_class
      Predicted class on the perturbed instance.
  orig_class
      Predicted class on the original instance.
  eps
      Small number to avoid dividing by 0.
  
  Returns
  -------
  Ratio between the distance to the prototype of the predicted class for the original instance and         the prototype of the predicted class for the perturbed instance.
docstr_tok: ["Parameters","--","--","--","--","--","X","Instance","to","encode","and","calculate","distance","metrics","for",".","adv_class","Predicted","class","on","the","perturbed","instance",".","orig_class","Predicted","class","on","the","original","instance",".","eps","Small","number","to","avoid","dividing","by","0",".","Returns","--","--","--","-","Ratio","between","the","distance","to","the","prototype","of","the","predicted","class","for","the","original","instance","and","the","prototype","of","the","predicted","class","for","the","perturbed","instance","."]
code: def score(
      self,
      X: np.ndarray,
      adv_class: int,
      orig_class: int,
      eps: float = 1e-10,
  ) -> float:
      """
          Parameters
          ----------
          X
              Instance to encode and calculate distance metrics for.
          adv_class
              Predicted class on the perturbed instance.
          orig_class
              Predicted class on the original instance.
          eps
              Small number to avoid dividing by 0.
  
          Returns
          -------
          Ratio between the distance to the prototype of the predicted class for the original instance and \
          the prototype of the predicted class for the perturbed instance.
          """
      if self.enc_model:
          if self.is_cat:
              X = num_to_ord(X, self.d_abs)
          if self.ohe:
              X, _ = ord_to_ohe(
                  X, self.cat_vars_ord
              )  # TODO: (Arnaud) is this a genuine bug?
          X_enc = self.enc.predict(X)  # type: ignore[union-attr]
          adv_proto = self.class_proto[adv_class]
          orig_proto = self.class_proto[orig_class]
          dist_adv = np.linalg.norm(X_enc - adv_proto)
          dist_orig = np.linalg.norm(X_enc - orig_proto)
      elif self.use_kdtree:
          dist_adv = self.kdtrees[adv_class].query(X, k=1)[0]
          dist_orig = self.kdtrees[orig_class].query(X, k=1)[0]
      else:
          logger.warning(
              "Need either an encoder or the k-d trees enabled to compute distance scores."
          )
      return dist_orig / (dist_adv + eps)
  
imports: import copy
  import logging
  import sys
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple, Union
  import numpy
  import tensorflow.compat.v1
  from alibi.api.defaults import DEFAULT_DATA_CFP, DEFAULT_META_CFP
  from alibi.api.interfaces import Explainer, Explanation, FitMixin
  from alibi.confidence import TrustScore
  from alibi.utils.discretizer import Discretizer
  from alibi.utils.distance import abdm, multidim_scaling, mvdm
  from alibi.utils.gradients import perturb
  from alibi.utils.mapping import num_to_ord, ohe_to_ord, ohe_to_ord_shape, ord_to_num, ord_to_ohe
  from alibi.utils.tf import argmax_grad, argmin_grad, one_hot_grad, round_grad
label_desc: Use image node_id 5 for calling the CounterfactualProto obj's underlying member method code with example usage: obj.score(X, adv_class, orig_class, eps) and returns: unknown