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: The function updates output tokens.
  
  It mimics the caching mechanism to update the output tokens for every
  new row of explanation that are to be explained.
  
  Parameters
  ----------
  output: numpy.ndarray
      Output(sentence/sentence ids) for an explanation row.
docstr_tok: ["The","function","updates","output","tokens",".","It","mimics","the","caching","mechanism","to","update","the","output","tokens","for","every","new","row","of","explanation","that","are","to","be","explained",".","Parameters","--","--","--","--","--","output",":","numpy.ndarray","Output","(","sentence\/sentence","ids",")","for","an","explanation","row","."]
code: def update_output_names(self, output):
      """The function updates output tokens.
  
      It mimics the caching mechanism to update the output tokens for every
      new row of explanation that are to be explained.
  
      Parameters
      ----------
      output: numpy.ndarray
          Output(sentence/sentence ids) for an explanation row.
      """
      # check if the target sentence has been updated (occurs when explaining a new row)
      if (self.output is None) or (
          not np.array_equal(self.output, output)
      ):
          self.output = output
          self.output_names = self.get_output_names(output)
  
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 3 for calling the TeacherForcing obj's underlying member method code with example usage: obj.update_output_names(output) without return types