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: Fit on the training data(typically the private data).
  
  :param data_feature: Training features, in numpy float32 array format.
         The size is [(number of training samples) x (maximum length)
         x (total dimension of features)]. Categorical features are stored
         by one-hot encoding; for example, if a categorical feature has 3
         possibilities, then it can take values between [1., 0., 0.],
         [0., 1., 0.], and [0., 0., 1.]. Each continuous feature should be
         normalized to [0, 1] or [-1, 1]. The array is padded by zeros after
         the time series ends.
  :param data_attribute: Training attributes, in numpy float32 array format. The size is
         [(number of training samples) x (total dimension of attributes)]. Categorical
         attributes are stored by one-hot encoding; for example, if a categorical
         attribute has 3 possibilities, then it can take values between [1., 0., 0.],
         [0., 1., 0.], and [0., 0., 1.]. Each continuous attribute should be normalized
         to [0, 1] or [-1, 1].
  :param data_gen_flag: Flags indicating the activation of features, in numpy float32
         array format. The size is [(number of training samples) x (maximum length)].
         1 means the time series is activated at this time step, 0 means the time series
         is inactivated at this timestep.
  :param feature_outputs: A list of Output indicates the meta data of data_feature.
  :param attribute_outputs: A list of Output indicates the meta data of data_attribute.
  :param epoch: training epoch.
  :param batch_size: training batchsize.
docstr_tok: ["Fit","on","the","training","data","(","typically","the","private","data",")",".",":","param","data_feature",":","Training","features",",","in","numpy","float32","array","format",".","The","size","is","[","(","number","of","training","samples",")","x","(","maximum","length",")","x","(","total","dimension","of","features",")","]",".","Categorical","features","are","stored","by","one-hot","encoding",";","for","example",",","if","a","categorical","feature","has","3","possibilities",",","then","it","can","take","values","between","[","1.",",","0.",",","0",".","]",",","[","0.",",","1.",",","0",".","]",",","and","[","0.",",","0.",",","1.","]",".","Each","continuous","feature","should","be","normalized","to","[","0",",","1","]","or","[","-1",",","1","]",".","The","array","is","padded","by","zeros","after","the","time","series","ends",".",":","param","data_attribute",":","Training","attributes",",","in","numpy","float32","array","format",".","The","size","is","[","(","number","of","training","samples",")","x","(","total","dimension","of","attributes",")","]",".","Categorical","attributes","are","stored","by","one-hot","encoding",";","for","example",",","if","a","categorical","attribute","has","3","possibilities",",","then","it","can","take","values","between","[","1.",",","0.",",","0",".","]",",","[","0.",",","1.",",","0",".","]",",","and","[","0.",",","0.",",","1.","]",".","Each","continuous","attribute","should","be","normalized","to","[","0",",","1","]","or","[","-1",",","1","]",".",":","param","data_gen_flag",":","Flags","indicating","the","activation","of","features",",","in","numpy","float32","array","format",".","The","size","is","[","(","number","of","training","samples",")","x","(","maximum","length",")","]",".","1","means","the","time","series","is","activated","at","this","time","step",",","0","means","the","time","series","is","inactivated","at","this","timestep",".",":","param","feature_outputs",":","A","list","of","Output","indicates","the","meta","data","of","data_feature",".",":","param","attribute_outputs",":","A","list","of","Output","indicates","the","meta","data","of","data_attribute",".",":","param","epoch",":","training","epoch",".",":","param","batch_size",":","training","batchsize","."]
code: def fit(
      self,
      data_feature,
      data_attribute,
      data_gen_flag,
      feature_outputs,
      attribute_outputs,
      epoch=1,
      batch_size=32,
  ):
      """
      Fit on the training data(typically the private data).
  
      :param data_feature: Training features, in numpy float32 array format.
             The size is [(number of training samples) x (maximum length)
             x (total dimension of features)]. Categorical features are stored
             by one-hot encoding; for example, if a categorical feature has 3
             possibilities, then it can take values between [1., 0., 0.],
             [0., 1., 0.], and [0., 0., 1.]. Each continuous feature should be
             normalized to [0, 1] or [-1, 1]. The array is padded by zeros after
             the time series ends.
      :param data_attribute: Training attributes, in numpy float32 array format. The size is
             [(number of training samples) x (total dimension of attributes)]. Categorical
             attributes are stored by one-hot encoding; for example, if a categorical
             attribute has 3 possibilities, then it can take values between [1., 0., 0.],
             [0., 1., 0.], and [0., 0., 1.]. Each continuous attribute should be normalized
             to [0, 1] or [-1, 1].
      :param data_gen_flag: Flags indicating the activation of features, in numpy float32
             array format. The size is [(number of training samples) x (maximum length)].
             1 means the time series is activated at this time step, 0 means the time series
             is inactivated at this timestep.
      :param feature_outputs: A list of Output indicates the meta data of data_feature.
      :param attribute_outputs: A list of Output indicates the meta data of data_attribute.
      :param epoch: training epoch.
      :param batch_size: training batchsize.
      """
      # data preparation
      real_data = {}
      real_data["data_feature"] = data_feature
      real_data["data_attribute"] = data_attribute
      real_data["data_gen_flag"] = data_gen_flag
      from bigdl.chronos.simulator.doppelganger.data_module import (
          DoppelGANgerDataModule,
      )
  
      self.data_module = DoppelGANgerDataModule(
          real_data=real_data,
          feature_outputs=feature_outputs,
          attribute_outputs=attribute_outputs,
          sample_len=self.sample_len,
          batch_size=batch_size,
      )
  
      from pytorch_lightning.callbacks import ModelCheckpoint
  
      checkpoint_callback = ModelCheckpoint(
          dirpath=self.ckpt_dir_model,
          save_top_k=-1,
          every_n_epochs=self.checkpoint_every_n_epoch,
      )
      if self.checkpoint_every_n_epoch != 0:
          with open(
              os.path.join(self.ckpt_dir, FEATURE_OUTPUT), "wb"
          ) as f:
              pickle.dump(self.data_module.data_feature_outputs, f)
          with open(
              os.path.join(self.ckpt_dir, ATTRIBUTE_OUTPUT), "wb"
          ) as f:
              pickle.dump(self.data_module.data_attribute_outputs, f)
  
      # build the model
      from bigdl.chronos.simulator.doppelganger.doppelganger_pl import (
          DoppelGANger_pl,
      )
  
      self.model = DoppelGANger_pl(
          data_feature_outputs=self.data_module.data_feature_outputs,
          data_attribute_outputs=self.data_module.data_attribute_outputs,
          L_max=self.L_max,
          sample_len=self.sample_len,
          num_real_attribute=self.num_real_attribute,
          **self.params,
      )
      from pytorch_lightning import Trainer
  
      self.trainer = Trainer(
          logger=False,
          callbacks=checkpoint_callback,
          max_epochs=epoch,
          default_root_dir=self.ckpt_dir,
      )
  
      # fit!
      self.trainer.fit(self.model, self.data_module)
  
file_path: BigDL/python/chronos/src/bigdl/chronos/simulator/doppelganger_simulator.py
imports: import pickle
  import os
  import numpy
  from bigdl.chronos.simulator.doppelganger.util import gen_attribute_input_noise, gen_feature_input_noise, gen_feature_input_data_free, renormalize_per_sample
  from bigdl.chronos.simulator.doppelganger.output import OutputType
  import torch
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the DPGANSimulator obj's underlying member method code with example usage: obj.fit(data_feature, data_attribute, data_gen_flag, feature_outputs, attribute_outputs, epoch, batch_size) without return types