class_docstr: Generates trackers from training data.
class_docstr_tok: ["Generates","trackers","from","training","data","."]
docstr: Mark actions which shouldn't be used during ML training.
  
  If a story starts with an action, we can not use
  that first action as a training example, as there is no
  history. There is one exception though, we do want to
  predict action listen. But because stories never
  contain action listen events (they are added when a
  story gets converted to a dialogue) we need to apply a
  small trick to avoid marking actions occurring after
  an action listen as unpredictable.
docstr_tok: ["Mark","actions","which","should","n't","be","used","during","ML","training",".","If","a","story","starts","with","an","action",",","we","can","not","use","that","first","action","as","a","training","example",",","as","there","is","no","history",".","There","is","one","exception","though",",","we","do","want","to","predict","action","listen",".","But","because","stories","never","contain","action","listen","events","(","they","are","added","when","a","story","gets","converted","to","a","dialogue",")","we","need","to","apply","a","small","trick","to","avoid","marking","actions","occurring","after","an","action","listen","as","unpredictable","."]
code: def _mark_first_action_in_story_steps_as_unpredictable(self) -> None:
      """Mark actions which shouldn't be used during ML training.
  
      If a story starts with an action, we can not use
      that first action as a training example, as there is no
      history. There is one exception though, we do want to
      predict action listen. But because stories never
      contain action listen events (they are added when a
      story gets converted to a dialogue) we need to apply a
      small trick to avoid marking actions occurring after
      an action listen as unpredictable.
      """
      for step in self.story_graph.story_steps:
          # TODO: this does not work if a step is the conversational start
          #       as well as an intermediary part of a conversation.
          #       This means a checkpoint can either have multiple
          #       checkpoints OR be the start of a conversation
          #       but not both.
          if STORY_START in {s.name for s in step.start_checkpoints}:
              for i, e in enumerate(step.events):
                  if isinstance(e, UserUttered):
                      # if there is a user utterance, that means before the
                      # user uttered something there has to be
                      # an action listen. therefore, any action that comes
                      # after this user utterance isn't the first
                      # action anymore and the tracker used for prediction
                      # is not empty anymore. Hence, it is fine
                      # to predict anything that occurs after an utterance.
                      break
                  if isinstance(e, ActionExecuted):
                      e.unpredictable = True
                      break
  
imports: from collections import defaultdict, namedtuple, deque
  import copy
  import logging
  import random
  from contextlib import contextmanager
  from tqdm import tqdm
  from typing import Optional, List, Text, Set, Dict, Tuple, Deque, DefaultDict, Any, Iterable, Generator
  from rasa.shared.constants import DOCS_URL_STORIES
  from rasa.shared.core.constants import SHOULD_NOT_BE_SET
  from rasa.shared.core.domain import Domain, State
  from rasa.shared.core.events import ActionExecuted, UserUttered, ActionReverted, UserUtteranceReverted, Restarted, Event, SlotSet, ActiveLoop
  from rasa.shared.core.trackers import DialogueStateTracker, FrozenState
  from rasa.shared.core.slots import Slot
  from rasa.shared.core.training_data.structures import StoryGraph, STORY_START, StoryStep, RuleStep, GENERATED_CHECKPOINT_PREFIX
  from rasa.shared.utils.io import is_logging_disabled
  import rasa.shared.utils.io
label_desc: Use image node_id 16 for calling the TrainingDataGenerator obj's underlying member method code with example usage: obj._mark_first_action_in_story_steps_as_unpredictable() without return types