class_docstr: `SingleEncoder`: Abstract class for single index encoders.
  Single encoders can be used to implement new encoding techniques.
  Each single encoder must implement an `_encode()` method that carries the encoding logic.
  
  The `_encode()` method must take an `index` as input and generate a encoded single `TimeSeries` as output.
class_docstr_tok: ["`","SingleEncoder","`",":","Abstract","class","for","single","index","encoders",".","Single","encoders","can","be","used","to","implement","new","encoding","techniques",".","Each","single","encoder","must","implement","an","`","_encode","(",")","`","method","that","carries","the","encoding","logic",".","The","`","_encode","(",")","`","method","must","take","an","`","index","`","as","input","and","generate","a","encoded","single","`","TimeSeries","`","as","output","."]
docstr: Returns encoded index for inference/prediction.
  
  Parameters
  ----------
  n
      The forecast horizon
  target
      The target TimeSeries used during training or passed to prediction as `series`
  covariates
      Optionally, the covariates used for prediction: past covariates if `self.index_generator` is a
      `PastCovariatesIndexGenerator`, future covariates if `self.index_generator` is a
      `FutureCovariatesIndexGenerator`
  merge_covariates
      Whether to merge the encoded TimeSeries with `covariates`.
docstr_tok: ["Returns","encoded","index","for","inference\/prediction",".","Parameters","--","--","--","--","--","n","The","forecast","horizon","target","The","target","TimeSeries","used","during","training","or","passed","to","prediction","as","`","series","`","covariates","Optionally",",","the","covariates","used","for","prediction",":","past","covariates","if","`","self.index_generator","`","is","a","`","PastCovariatesIndexGenerator","`",",","future","covariates","if","`","self.index_generator","`","is","a","`","FutureCovariatesIndexGenerator","`","merge_covariates","Whether","to","merge","the","encoded","TimeSeries","with","`","covariates","`","."]
code: def encode_inference(
      self,
      n: int,
      target: TimeSeries,
      covariates: Optional[TimeSeries] = None,
      merge_covariates: bool = True,
      **kwargs,
  ) -> TimeSeries:
      """Returns encoded index for inference/prediction.
  
      Parameters
      ----------
      n
          The forecast horizon
      target
          The target TimeSeries used during training or passed to prediction as `series`
      covariates
          Optionally, the covariates used for prediction: past covariates if `self.index_generator` is a
          `PastCovariatesIndexGenerator`, future covariates if `self.index_generator` is a
          `FutureCovariatesIndexGenerator`
      merge_covariates
          Whether to merge the encoded TimeSeries with `covariates`.
      """
      # some encoders must be fit before `encode_inference()`
      raise_if(
          not self.fit_called and self.requires_fit,
          f"`{self.__class__.__name__}` object must be trained before inference. "
          f"Call method `encode_train()` before `encode_inference()`.",
          logger=logger,
      )
  
      # exclude encoded components from covariates to add the newly encoded components later
      covariates = self._drop_encoded_components(
          covariates, self.components
      )
  
      # generate index and encodings
      index, target_end = self.index_generator.generate_inference_idx(
          n, target, covariates
      )
      encoded = self._encode(index, target_end, target.dtype)
  
      # optionally, merge encodings with original `covariates` series
      encoded = (
          self._merge_covariates(encoded, covariates=covariates)
          if merge_covariates
          else encoded
      )
  
      # optionally, save encoded component names also at inference as some encoders do not have to be trained before
      if self.components.empty:
          components = encoded.components
          if covariates is not None:
              components = components[
                  ~components.isin(covariates.components)
              ]
          self._components = components
  
      return encoded
  
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 4 for calling the SingleEncoder obj's underlying member method code with example usage: obj.encode_inference(n, target, covariates, merge_covariates) and returns: encoded