class_docstr: Synthetic data set generated by providing a recipe.
  
  A recipe is either a (non-deterministic) function
  
      f(length: int, global_state: dict) -> dict
  
  or list of (field, function) tuples of the form
  
      (field: str, f(data: dict, length: int, global_state: dict) -> dict)
  
  which is processed sequentially, with data initially set to {},
  and each entry updating data[field] to the output of the function
  call.
class_docstr_tok: ["Synthetic","data","set","generated","by","providing","a","recipe",".","A","recipe","is","either","a","(","non-deterministic",")","function","f","(","length",":","int",",","global_state",":","dict",")","-",">","dict","or","list","of","(","field",",","function",")","tuples","of","the","form","(","field",":","str",",","f","(","data",":","dict",",","length",":","int",",","global_state",":","dict",")","-",">","dict",")","which","is","processed","sequentially",",","with","data","initially","set","to","{","}",",","and","each","entry","updating","data","[","field","]","to","the","output","of","the","function","call","."]
docstr: :param recipe: The recipe to generate from (see class docstring)
  :param metadata: The metadata to be included in the dataset
  :param max_train_length: The maximum length of a training time series.
  :param prediction_length: The length of the prediction range
  :param num_timeseries: Number of time series to generate
  :param trim_length_fun: Callable f(x: int) -> int returning the
         (shortened) training length
  :param data_start: Start date for the data set
code: def __init__(
      self,
      recipe: Union[
          Callable, Dict[str, Callable], List[Tuple[str, Callable]]
      ],
      metadata: MetaData,
      max_train_length: int,
      prediction_length: int,
      num_timeseries: int,
      trim_length_fun=lambda x, **kwargs: 0,
      data_start=pd.Timestamp("2014-01-01"),
  ) -> None:
      """
  
      :param recipe: The recipe to generate from (see class docstring)
      :param metadata: The metadata to be included in the dataset
      :param max_train_length: The maximum length of a training time series.
      :param prediction_length: The length of the prediction range
      :param num_timeseries: Number of time series to generate
      :param trim_length_fun: Callable f(x: int) -> int returning the
             (shortened) training length
      :param data_start: Start date for the data set
      """
      super().__init__(freq=metadata.freq)
  
      self.recipe = recipe
      self._metadata = metadata
      self.max_train_length = max_train_length
      self.prediction_length = prediction_length
      self.trim_length_fun = trim_length_fun
      self.num_timeseries = num_timeseries
      self.data_start = cast(
          pd.Period, pd.Period(data_start, freq=self._metadata.freq)
      )
  
imports: import math
  import random
  from abc import abstractmethod
  from typing import Callable, Dict, List, NamedTuple, Optional, Tuple, Union, cast
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from pandas.tseries.offsets import BaseOffset, Week
  from gluonts.dataset.artificial.recipe import BinaryHolidays, BinaryMarkovChain, Constant, ForEachCat, Lag, LinearTrend, RandomCat, RandomGaussian, Stack, generate, take_as_list
  from gluonts.dataset.common import BasicFeatureInfo, CategoricalFeatureInfo, DataEntry, Dataset, ListDataset, MetaData, TrainDatasets
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.stat import DatasetStatistics, calculate_dataset_statistics
label_desc: Use image node_id 1 to create a new RecipeDataset object from inherited base classes: ArtificialDataset with example: obj = RecipeDataset(recipe, metadata, max_train_length, prediction_length, num_timeseries, trim_length_fun, data_start)