class_docstr: PyTorch Dataset for fitting timeseries models.
  
  The dataset automates common tasks such as
  
  * scaling and encoding of variables
  * normalizing the target variable
  * efficiently converting timeseries in pandas dataframes to torch tensors
  * holding information about static and time-varying variables known and unknown in the future
  * holiding information about related categories (such as holidays)
  * downsampling for data augmentation
  * generating inference, validation and test datasets
  * etc.
class_docstr_tok: ["PyTorch","Dataset","for","fitting","timeseries","models",".","The","dataset","automates","common","tasks","such","as","*","scaling","and","encoding","of","variables","*","normalizing","the","target","variable","*","efficiently","converting","timeseries","in","pandas","dataframes","to","torch","tensors","*","holding","information","about","static","and","time-varying","variables","known","and","unknown","in","the","future","*","holiding","information","about","related","categories","(","such","as","holidays",")","*","downsampling","for","data","augmentation","*","generating","inference",",","validation","and","test","datasets","*","etc","."]
docstr: Scale and encode values.
  
  Args:
      name (str): name of variable
      values (Union[pd.Series, torch.Tensor, np.ndarray]): values to encode/scale
      data (pd.DataFrame, optional): extra data used for scaling (e.g. dataframe with groups columns).
          Defaults to None.
      inverse (bool, optional): if to conduct inverse transformation. Defaults to False.
      group_id (bool, optional): If the passed name refers to a group id (different encoders are used for these).
          Defaults to False.
      **kwargs: additional arguments for transform/inverse_transform method
  
  Returns:
      np.ndarray: (de/en)coded/(de)scaled values
code: def transform_values(
      self,
      name: str,
      values: Union[pd.Series, torch.Tensor, np.ndarray],
      data: pd.DataFrame = None,
      inverse=False,
      group_id: bool = False,
      **kwargs,
  ) -> np.ndarray:
      """
      Scale and encode values.
  
      Args:
          name (str): name of variable
          values (Union[pd.Series, torch.Tensor, np.ndarray]): values to encode/scale
          data (pd.DataFrame, optional): extra data used for scaling (e.g. dataframe with groups columns).
              Defaults to None.
          inverse (bool, optional): if to conduct inverse transformation. Defaults to False.
          group_id (bool, optional): If the passed name refers to a group id (different encoders are used for these).
              Defaults to False.
          **kwargs: additional arguments for transform/inverse_transform method
  
      Returns:
          np.ndarray: (de/en)coded/(de)scaled values
      """
      transformer = self.get_transformer(name, group_id=group_id)
      if transformer is None:
          return values
      if inverse:
          transform = transformer.inverse_transform
      else:
          transform = transformer.transform
  
      if group_id:
          name = self._group_ids_mapping[name]
      # remaining categories
      if (
          name
          in self.flat_categoricals + self.group_ids + self._group_ids
      ):
          return transform(values, **kwargs)
  
      # reals
      elif name in self.reals:
          if isinstance(transformer, GroupNormalizer):
              return transform(values, data, **kwargs)
          elif isinstance(transformer, EncoderNormalizer):
              return transform(values, **kwargs)
          else:
              if isinstance(values, pd.Series):
                  values = values.to_frame()
                  return np.asarray(
                      transform(values, **kwargs)
                  ).reshape(-1)
              else:
                  values = values.reshape(-1, 1)
                  return transform(values, **kwargs).reshape(-1)
      else:
          return values
  
imports: from copy import copy, deepcopy
  from functools import lru_cache
  import inspect
  from typing import Any, Callable, Dict, List, Tuple, Union
  import warnings
  import matplotlib.pyplot
  import numpy
  import pandas
  from sklearn.exceptions import NotFittedError
  from sklearn.preprocessing import RobustScaler, StandardScaler
  from sklearn.utils.validation import check_is_fitted
  import torch
  from torch.distributions import Beta
  from torch.nn.utils import rnn
  from torch.utils.data import DataLoader, Dataset
  from torch.utils.data.sampler import Sampler, SequentialSampler
  from pytorch_forecasting.data.encoders import EncoderNormalizer, GroupNormalizer, MultiNormalizer, NaNLabelEncoder, TorchNormalizer
  from pytorch_forecasting.data.samplers import TimeSynchronizedBatchSampler
  from pytorch_forecasting.utils import repr_class
label_desc: Use image node_id 16 for calling the TimeSeriesDataSet obj's underlying member method code with example usage: obj.transform_values(name, values, data, inverse, group_id) and returns: values, transform, values, transform, transform, np, transform