class_docstr: Memory Augmented Time Series Dataset
  
  Args:
      handler (DataHandler): data handler
      segments (dict): data split segments
      seq_len (int): time series sequence length
      horizon (int): label horizon
      num_states (int): how many memory states to be added
      memory_mode (str): memory mode (daily or sample)
      batch_size (int): batch size (<0 will use daily sampling)
      n_samples (int): number of samples in the same day
      shuffle (bool): whether shuffle data
      drop_last (bool): whether drop last batch < batch_size
      input_size (int): reshape flatten rows as this input_size (backward compatibility)
class_docstr_tok: ["Memory","Augmented","Time","Series","Dataset","Args",":","handler","(","DataHandler",")",":","data","handler","segments","(","dict",")",":","data","split","segments","seq_len","(","int",")",":","time","series","sequence","length","horizon","(","int",")",":","label","horizon","num_states","(","int",")",":","how","many","memory","states","to","be","added","memory_mode","(","str",")",":","memory","mode","(","daily","or","sample",")","batch_size","(","int",")",":","batch","size","(","<","0","will","use","daily","sampling",")","n_samples","(","int",")",":","number","of","samples","in","the","same","day","shuffle","(","bool",")",":","whether","shuffle","data","drop_last","(","bool",")",":","whether","drop","last","batch","<","batch_size","input_size","(","int",")",":","reshape","flatten","rows","as","this","input_size","(","backward","compatibility",")"]
code: def __init__(
      self,
      handler,
      segments,
      seq_len=60,
      horizon=0,
      num_states=0,
      memory_mode="sample",
      batch_size=-1,
      n_samples=None,
      shuffle=True,
      drop_last=False,
      input_size=None,
      **kwargs,
  ):
      assert (
          num_states == 0 or horizon > 0
      ), "please specify `horizon` to avoid data leakage"
      assert memory_mode in [
          "sample",
          "daily",
      ], "unsupported memory mode"
      assert (
          memory_mode == "sample" or batch_size < 0
      ), "daily memory requires daily sampling (`batch_size < 0`)"
      assert batch_size != 0, "invalid batch size"
  
      if batch_size > 0 and n_samples is not None:
          warnings.warn(
              "`n_samples` can only be used for daily sampling (`batch_size < 0`)"
          )
  
      self.seq_len = seq_len
      self.horizon = horizon
      self.num_states = num_states
      self.memory_mode = memory_mode
      self.batch_size = batch_size
      self.n_samples = n_samples
      self.shuffle = shuffle
      self.drop_last = drop_last
      self.input_size = input_size
      self.params = (
          batch_size,
          n_samples,
          drop_last,
          shuffle,
      )  # for train/eval switch
  
      super().__init__(handler, segments, **kwargs)
  
imports: import copy
  import torch
  import warnings
  import numpy
  import pandas
  from qlib.data.dataset import DatasetH
label_desc: Use image node_id 1 to create a new MTSDatasetH object from inherited base classes: DatasetH with example: obj = MTSDatasetH(handler, segments, seq_len, horizon, num_states, memory_mode, batch_size, n_samples, shuffle, drop_last, input_size)