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 tokenizes output sentences and returns ids.
  
  Parameters
  ----------
  X: numpy.ndarray
      Output(sentence/sentence ids) for an explanation row.
  
  Returns
  -------
  numpy.ndarray
      An array of output(target sentence) ids.
docstr_tok: ["The","function","tokenizes","output","sentences","and","returns","ids",".","Parameters","--","--","--","--","--","X",":","numpy.ndarray","Output","(","sentence\/sentence","ids",")","for","an","explanation","row",".","Returns","--","--","--","-","numpy.ndarray","An","array","of","output","(","target","sentence",")","ids","."]
code: def get_outputs(self, X):
      """The function tokenizes output sentences and returns ids.
  
      Parameters
      ----------
      X: numpy.ndarray
          Output(sentence/sentence ids) for an explanation row.
  
      Returns
      -------
      numpy.ndarray
          An array of output(target sentence) ids.
      """
      # check if output is a sentence or already parsed target ids
      if X.dtype.type is np.str_:
          parsed_tokenizer_dict = parse_prefix_suffix_for_tokenizer(
              self.similarity_tokenizer
          )
          keep_prefix, keep_suffix = (
              parsed_tokenizer_dict["keep_prefix"],
              parsed_tokenizer_dict["keep_suffix"],
          )
          if keep_suffix > 0:
              output_ids = np.array(
                  self.similarity_tokenizer(X.tolist(), padding=True)[
                      "input_ids"
                  ]
              )[:, keep_prefix:-keep_suffix]
          else:
              output_ids = np.array(
                  self.similarity_tokenizer(X.tolist(), padding=True)[
                      "input_ids"
                  ]
              )[:, keep_prefix:]
      else:
          output_ids = X
      return output_ids
  
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 5 for calling the TeacherForcing obj's underlying member method code with example usage: obj.get_outputs(X) and returns: output_ids