class_docstr: Generates scores (log odds) for output text explanation algorithms using Teacher Forcing technique.
  
  This class supports generation of log odds for transformer models as well as functions. In model agnostic
  cases (model is function) it expects a similarity_model and similarity_tokenizer to approximate log odd scores
  for target sentence generated by the model.
class_docstr_tok: ["Generates","scores","(","log","odds",")","for","output","text","explanation","algorithms","using","Teacher","Forcing","technique",".","This","class","supports","generation","of","log","odds","for","transformer","models","as","well","as","functions",".","In","model","agnostic","cases","(","model","is","function",")","it","expects","a","similarity_model","and","similarity_tokenizer","to","approximate","log","odd","scores","for","target","sentence","generated","by","the","model","."]
docstr: Computes log odds scores of generating output(text) for a given batch of input(text/image) .
  
  Parameters
  ----------
  X: numpy.ndarray
      An array containing a list of masked inputs.
  
  Y: numpy.ndarray
      An array containing a list of target sentence/ids.
  
  Returns
  -------
  numpy.ndarray
      A numpy array of log odds scores for every input pair (masked_X, X)
docstr_tok: ["Computes","log","odds","scores","of","generating","output","(","text",")","for","a","given","batch","of","input","(","text\/image",")",".","Parameters","--","--","--","--","--","X",":","numpy.ndarray","An","array","containing","a","list","of","masked","inputs",".","Y",":","numpy.ndarray","An","array","containing","a","list","of","target","sentence\/ids",".","Returns","--","--","--","-","numpy.ndarray","A","numpy","array","of","log","odds","scores","for","every","input","pair","(","masked_X",",","X",")"]
code: def __call__(self, X, Y):
      """Computes log odds scores of generating output(text) for a given batch of input(text/image) .
  
      Parameters
      ----------
      X: numpy.ndarray
          An array containing a list of masked inputs.
  
      Y: numpy.ndarray
          An array containing a list of target sentence/ids.
  
      Returns
      -------
      numpy.ndarray
          A numpy array of log odds scores for every input pair (masked_X, X)
      """
      output_batch = None
      # caching updates output names and target sentence ids
      self.update_output_names(Y[:1])
      start_batch_idx, end_batch_idx = 0, len(X)
      while start_batch_idx < end_batch_idx:
          X_batch = X[
              start_batch_idx : start_batch_idx + self.batch_size
          ]
          Y_batch = Y[
              start_batch_idx : start_batch_idx + self.batch_size
          ]
          logits = self.get_teacher_forced_logits(X_batch, Y_batch)
          logodds = self.get_logodds(logits)
          if output_batch is None:
              output_batch = logodds
          else:
              output_batch = np.concatenate((output_batch, logodds))
          start_batch_idx += self.batch_size
      return output_batch
  
file_path: shap/shap/models/_teacher_forcing.py
imports: import numpy
  import scipy.special
  from ..None import models
  from .._serializable import Deserializer, Serializer
  from ..utils import safe_isinstance
  from ..utils.transformers import getattr_silent, parse_prefix_suffix_for_tokenizer
  from ._model import Model
label_desc: Use image node_id 2 for calling the TeacherForcing obj's underlying member method code with example usage: obj.__call__(X, Y) and returns: output_batch