class_docstr: Time series encoder. This module can learn features for any `order_by` temporal column, both with and without accompanying target data.
  
  The backbone of this encoder is either a recurrent neural network or a transformer; both structured in an encoder-decoder fashion.
class_docstr_tok: ["Time","series","encoder",".","This","module","can","learn","features","for","any","`","order_by","`","temporal","column",",","both","with","and","without","accompanying","target","data",".","The","backbone","of","this","encoder","is","either","a","recurrent","neural","network","or","a","transformer",";","both","structured","in","an","encoder-decoder","fashion","."]
code: def __init__(
      self,
      stop_after: float,
      is_target: bool = False,
      original_type: str = None,
      target: str = None,
      grouped_by: List[str] = [],
      encoder_type: str = "rnn",
      device: str = "",
  ):
      super().__init__(is_target)
      self.device = get_device_from_name(device)
      self.target = target
      self.grouped_by = grouped_by
      self._learning_rate = 0.01
      self.output_size = 128
      self._transformer_hidden_size = None
      self._epochs = int(1e5)  # default training epochs
      self._stop_on_n_bad_epochs = 5  # stop training after N epochs where loss is worse than running avg
      self._epochs_running_avg = (
          5  # amount of epochs for running average
      )
      self._pytorch_wrapper = torch.FloatTensor
      self.is_prepared = False
      self._is_setup = False
      self._max_ts_length = 0
      self._sos = 0.0  # start of sequence for decoding
      self._eos = (
          0.0  # end of input sequence -- padding value for batches
      )
      self._n_dims = 1
      self._normalizer = None
      self.dep_norms = (
          {}
      )  # dict of dict of normalizers for each dependency (can be grouped-by some column)
      self._target_type = None
      self._group_combinations = None
      self.original_type = original_type
      self.stop_after = stop_after
      if encoder_type.lower() == "rnn":
          self.encoder_class = EncoderRNNNumerical
      elif encoder_type.lower() == "transformer":
          self.encoder_class = TransformerEncoder
  
imports: import time
  from math import gcd
  from typing import List
  from copy import deepcopy
  import numpy
  import pandas
  import torch
  import torch.nn
  from torch import optim
  from type_infer.dtype import dtype
  from lightwood.helpers.log import log
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.device import get_device_from_name
  from lightwood.helpers.torch import LightwoodAutocast
  from lightwood.encoder.datetime import DatetimeNormalizerEncoder
  from lightwood.encoder.time_series.helpers.rnn_helpers import EncoderRNNNumerical, DecoderRNNNumerical
  from lightwood.encoder.helpers import MinMaxNormalizer, CatNormalizer
  from lightwood.encoder.time_series.helpers.transformer_helpers import TransformerEncoder, get_chunk, len_to_mask
label_desc: Use image node_id 1 to create a new TimeSeriesEncoder object from inherited base classes: BaseEncoder with example: obj = TimeSeriesEncoder(stop_after, is_target, original_type, target, grouped_by, encoder_type, device)