class_docstr: Doppelganger Simulator for time series generation.
  The codes and algorithm are adapted from https://github.com/fjxmlzn/DoppelGANger.
class_docstr_tok: ["Doppelganger","Simulator","for","time","series","generation",".","The","codes","and","algorithm","are","adapted","from","https",":","\/\/github.com\/fjxmlzn\/DoppelGANger","."]
docstr: Initialize a doppelganger simulator.
  
  :param L_max: the maximum length of your feature.
  :param sample_len: the sample length to control LSTM length, should be a divider to L_max
  :param feature_dim: dimention of the feature
  :param num_real_attribute: the length of you attribute, which should be equal to the
         len(data_attribute).
  :param discriminator_num_layers: MLP layer num for discriminator.
  :param discriminator_num_units: MLP hidden unit for discriminator.
  :param attr_discriminator_num_layers: MLP layer num for attr discriminator.
  :param attr_discriminator_num_units: MLP hidden unit for attr discriminator.
  :param attribute_num_units: MLP layer num for attr generator/addi attr generator.
  :param attribute_num_layers:  MLP hidden unit for attr generator/addi attr generator.
  :param feature_num_units: LSTM hidden unit for feature generator.
  :param feature_num_layers: LSTM layer num for feature generator.
  :param attribute_input_noise_dim: noise data dim for attr generator.
  :param addi_attribute_input_noise_dim: noise data dim for addi attr generator.
  :param d_gp_coe: gradient penalty ratio for d loss.
  :param attr_d_gp_coe: gradient penalty ratio for attr d loss.
  :param g_attr_d_coe: ratio between feature loss and attr loss for g loss.
  :param d_lr: learning rate for discriminator.
  :param attr_d_lr: learning rate for attr discriminator.
  :param g_lr: learning rate for genereators.
  :param g_rounds: g rounds.
  :param d_rounds: d rounds.
  :param seed: random seed.
  :param num_threads: num of threads to be used for training.
  :param ckpt_dir: The checkpoint location, defaults to the working dir.
  :param checkpoint_every_n_epoch: checkpoint every n epoch, defaults to 0
         for no checkpoints.
docstr_tok: ["Initialize","a","doppelganger","simulator",".",":","param","L_max",":","the","maximum","length","of","your","feature",".",":","param","sample_len",":","the","sample","length","to","control","LSTM","length",",","should","be","a","divider","to","L_max",":","param","feature_dim",":","dimention","of","the","feature",":","param","num_real_attribute",":","the","length","of","you","attribute",",","which","should","be","equal","to","the","len","(","data_attribute",")",".",":","param","discriminator_num_layers",":","MLP","layer","num","for","discriminator",".",":","param","discriminator_num_units",":","MLP","hidden","unit","for","discriminator",".",":","param","attr_discriminator_num_layers",":","MLP","layer","num","for","attr","discriminator",".",":","param","attr_discriminator_num_units",":","MLP","hidden","unit","for","attr","discriminator",".",":","param","attribute_num_units",":","MLP","layer","num","for","attr","generator\/addi","attr","generator",".",":","param","attribute_num_layers",":","MLP","hidden","unit","for","attr","generator\/addi","attr","generator",".",":","param","feature_num_units",":","LSTM","hidden","unit","for","feature","generator",".",":","param","feature_num_layers",":","LSTM","layer","num","for","feature","generator",".",":","param","attribute_input_noise_dim",":","noise","data","dim","for","attr","generator",".",":","param","addi_attribute_input_noise_dim",":","noise","data","dim","for","addi","attr","generator",".",":","param","d_gp_coe",":","gradient","penalty","ratio","for","d","loss",".",":","param","attr_d_gp_coe",":","gradient","penalty","ratio","for","attr","d","loss",".",":","param","g_attr_d_coe",":","ratio","between","feature","loss","and","attr","loss","for","g","loss",".",":","param","d_lr",":","learning","rate","for","discriminator",".",":","param","attr_d_lr",":","learning","rate","for","attr","discriminator",".",":","param","g_lr",":","learning","rate","for","genereators",".",":","param","g_rounds",":","g","rounds",".",":","param","d_rounds",":","d","rounds",".",":","param","seed",":","random","seed",".",":","param","num_threads",":","num","of","threads","to","be","used","for","training",".",":","param","ckpt_dir",":","The","checkpoint","location",",","defaults","to","the","working","dir",".",":","param","checkpoint_every_n_epoch",":","checkpoint","every","n","epoch",",","defaults","to","0","for","no","checkpoints","."]
code: def __init__(
      self,
      L_max,
      sample_len,
      feature_dim,
      num_real_attribute,
      discriminator_num_layers=5,
      discriminator_num_units=200,
      attr_discriminator_num_layers=5,
      attr_discriminator_num_units=200,
      attribute_num_units=100,
      attribute_num_layers=3,
      feature_num_units=100,
      feature_num_layers=1,
      attribute_input_noise_dim=5,
      addi_attribute_input_noise_dim=5,
      d_gp_coe=10,
      attr_d_gp_coe=10,
      g_attr_d_coe=1,
      d_lr=0.001,
      attr_d_lr=0.001,
      g_lr=0.001,
      g_rounds=1,
      d_rounds=1,
      seed=0,
      num_threads=None,
      ckpt_dir=".",
      checkpoint_every_n_epoch=0,
  ):
      """
      Initialize a doppelganger simulator.
  
      :param L_max: the maximum length of your feature.
      :param sample_len: the sample length to control LSTM length, should be a divider to L_max
      :param feature_dim: dimention of the feature
      :param num_real_attribute: the length of you attribute, which should be equal to the
             len(data_attribute).
      :param discriminator_num_layers: MLP layer num for discriminator.
      :param discriminator_num_units: MLP hidden unit for discriminator.
      :param attr_discriminator_num_layers: MLP layer num for attr discriminator.
      :param attr_discriminator_num_units: MLP hidden unit for attr discriminator.
      :param attribute_num_units: MLP layer num for attr generator/addi attr generator.
      :param attribute_num_layers:  MLP hidden unit for attr generator/addi attr generator.
      :param feature_num_units: LSTM hidden unit for feature generator.
      :param feature_num_layers: LSTM layer num for feature generator.
      :param attribute_input_noise_dim: noise data dim for attr generator.
      :param addi_attribute_input_noise_dim: noise data dim for addi attr generator.
      :param d_gp_coe: gradient penalty ratio for d loss.
      :param attr_d_gp_coe: gradient penalty ratio for attr d loss.
      :param g_attr_d_coe: ratio between feature loss and attr loss for g loss.
      :param d_lr: learning rate for discriminator.
      :param attr_d_lr: learning rate for attr discriminator.
      :param g_lr: learning rate for genereators.
      :param g_rounds: g rounds.
      :param d_rounds: d rounds.
      :param seed: random seed.
      :param num_threads: num of threads to be used for training.
      :param ckpt_dir: The checkpoint location, defaults to the working dir.
      :param checkpoint_every_n_epoch: checkpoint every n epoch, defaults to 0
             for no checkpoints.
      """
      # additional settings
      from pytorch_lightning import seed_everything
  
      seed_everything(seed=seed)
      if num_threads is not None:
          torch.set_num_threads(num_threads)
      self.ckpt_dir = ckpt_dir
      self.ckpt_dir_model = os.path.join(self.ckpt_dir, "model")
      self.checkpoint_every_n_epoch = checkpoint_every_n_epoch
      self.sample_len = sample_len
      self.L_max = L_max
      self.feature_dim = feature_dim
      self.num_real_attribute = num_real_attribute
  
      # hparam saving
      self.params = {
          "discriminator_num_layers": discriminator_num_layers,
          "discriminator_num_units": discriminator_num_units,
          "attr_discriminator_num_layers": attr_discriminator_num_layers,
          "attr_discriminator_num_units": attr_discriminator_num_units,
          "attribute_num_units": attribute_num_units,
          "attribute_num_layers": attribute_num_layers,
          "feature_num_units": feature_num_units,
          "feature_num_layers": feature_num_layers,
          "attribute_input_noise_dim": attribute_input_noise_dim,
          "addi_attribute_input_noise_dim": addi_attribute_input_noise_dim,
          "d_gp_coe": d_gp_coe,
          "attr_d_gp_coe": attr_d_gp_coe,
          "g_attr_d_coe": g_attr_d_coe,
          "d_lr": d_lr,
          "attr_d_lr": attr_d_lr,
          "g_lr": g_lr,
          "g_rounds": g_rounds,
          "d_rounds": d_rounds,
      }
  
      # model init
      self.model = None
  
file_path: analytics-zoo/pyzoo/zoo/chronos/simulator/doppelganger_simulator.py
imports: import pickle
  import os
  import numpy
  from zoo.chronos.simulator.doppelganger.util import gen_attribute_input_noise, gen_feature_input_noise, gen_feature_input_data_free, renormalize_per_sample
  from zoo.chronos.simulator.doppelganger.output import OutputType
  import torch
  import torch.nn.functional
label_desc: Use image node_id 1 to create a new DPGANSimulator object  with example: obj = DPGANSimulator(L_max, sample_len, feature_dim, num_real_attribute, discriminator_num_layers, discriminator_num_units, attr_discriminator_num_layers, attr_discriminator_num_units, attribute_num_units, attribute_num_layers, feature_num_units, feature_num_layers, attribute_input_noise_dim, addi_attribute_input_noise_dim, d_gp_coe, attr_d_gp_coe, g_attr_d_coe, d_lr, attr_d_lr, g_lr, g_rounds, d_rounds, seed, num_threads, ckpt_dir, checkpoint_every_n_epoch)