class_docstr: Generates trackers from training data.
class_docstr_tok: ["Generates","trackers","from","training","data","."]
docstr: Subsample the list of trackers to retrieve a random subset.
docstr_tok: ["Subsample","the","list","of","trackers","to","retrieve","a","random","subset","."]
code: def _subsample_trackers(
      self,
      incoming_trackers: List[TrackerWithCachedStates],
      max_number_of_trackers: int,
  ) -> List[TrackerWithCachedStates]:
      """Subsample the list of trackers to retrieve a random subset."""
      # if flows get very long and have a lot of forks we
      # get into trouble by collecting too many trackers
      # hence the sub sampling
      if max_number_of_trackers is not None:
          return _subsample_array(
              incoming_trackers,
              max_number_of_trackers,
              rand=self.config.rand,
          )
      else:
          return incoming_trackers
  
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 8 for calling the TrainingDataGenerator obj's underlying member method code with example usage: obj._subsample_trackers(incoming_trackers, max_number_of_trackers) and returns: _subsample_array, incoming_trackers