class_docstr: Generates (support, test) pairs for episodic training.
  
  Precomputes all (support, test) pairs at construction. Allows to reduce
  overhead from computation.
class_docstr_tok: ["Generates","(","support",",","test",")","pairs","for","episodic","training",".","Precomputes","all","(","support",",","test",")","pairs","at","construction",".","Allows","to","reduce","overhead","from","computation","."]
docstr: Parameters
  ----------
  dataset: dc.data.Dataset
      Holds dataset from which support sets will be sampled.
  n_pos: int
      Number of positive samples
  n_neg: int
      Number of negative samples.
  n_test: int
      Number of samples in test set.
  n_episodes_per_task: int
      Number of (support, task) pairs to sample per task.
  replace: bool
      Whether to use sampling with or without replacement.
docstr_tok: ["Parameters","--","--","--","--","--","dataset",":","dc.data.Dataset","Holds","dataset","from","which","support","sets","will","be","sampled",".","n_pos",":","int","Number","of","positive","samples","n_neg",":","int","Number","of","negative","samples",".","n_test",":","int","Number","of","samples","in","test","set",".","n_episodes_per_task",":","int","Number","of","(","support",",","task",")","pairs","to","sample","per","task",".","replace",":","bool","Whether","to","use","sampling","with","or","without","replacement","."]
code: def __init__(
      self, dataset, n_pos, n_neg, n_test, n_episodes_per_task
  ):
      """
      Parameters
      ----------
      dataset: dc.data.Dataset
          Holds dataset from which support sets will be sampled.
      n_pos: int
          Number of positive samples
      n_neg: int
          Number of negative samples.
      n_test: int
          Number of samples in test set.
      n_episodes_per_task: int
          Number of (support, task) pairs to sample per task.
      replace: bool
          Whether to use sampling with or without replacement.
      """
      time_start = time.time()
      self.tasks = range(len(dataset.get_task_names()))
      self.n_tasks = len(self.tasks)
      self.n_episodes_per_task = n_episodes_per_task
      self.dataset = dataset
      self.n_pos = n_pos
      self.n_neg = n_neg
      self.task_episodes = {}
  
      for task in range(self.n_tasks):
          task_supports = get_task_support(
              self.dataset, n_episodes_per_task, n_pos, n_neg, task
          )
          task_tests = get_task_test(
              self.dataset, n_episodes_per_task, n_test, task
          )
          self.task_episodes[task] = (task_supports, task_tests)
  
      # Init the iterator
      self.perm_tasks = np.random.permutation(self.tasks)
      # Set initial iterator state
      self.task_num = 0
      self.trial_num = 0
      time_end = time.time()
      logger.info(
          "Constructing EpisodeGenerator took %s seconds"
          % str(time_end - time_start)
      )
  
imports: import logging
  import time
  import numpy
  from deepchem.data import NumpyDataset
label_desc: Use image node_id 1 to create a new EpisodeGenerator object from inherited base classes: object with example: obj = EpisodeGenerator(dataset, n_pos, n_neg, n_test, n_episodes_per_task)