class_docstr: Connects the encoder stage to the corresponding methods
class_docstr_tok: ["Connects","the","encoder","stage","to","the","corresponding","methods"]
code: def __init__(
      self, stage: Literal["train", "inference", "train_inference"]
  ):
      self.method = None
      if stage == "train":
          self.method = "encode_train"
      elif stage == "inference":
          self.method = "encode_inference"
      elif stage == "train_inference":
          self.method = "encode_train_inference"
      else:
          raise_log(
              ValueError(
                  f"Unknown encoder `stage={stage}`. Must be on of `('train', 'inference', 'train_inference')`"
              ),
              logger,
          )
  
imports: from abc import ABC, abstractmethod
  from typing import List, Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  from darts import TimeSeries
  from darts.dataprocessing.transformers import FittableDataTransformer
  from darts.logging import get_logger, raise_if, raise_log
  from darts.utils.timeseries_generation import generate_index
label_desc: Use image node_id 1 to create a new _EncoderMethod object  with example: obj = _EncoderMethod(stage)