class_docstr: Implements calculation of date features. The CustomDateFeatureSet is
  applied on a pandas Series with Datetimeindex and returns a 1D array of
  the shape (1, len(date_indices)).
  
  Note that for lower than daily granularity the distance to the holiday is
  still computed on a per-day basis.
  
  Example use:
  
      >>> import pandas as pd
      >>> cfs = CustomDateFeatureSet([pd.to_datetime('20191129', format='%Y%m%d'),
      ...                             pd.to_datetime('20200101', format='%Y%m%d')])
      >>> date_indices = pd.date_range(
      ...     start="2019-11-24",
      ...     end="2019-12-31",
      ...     freq='D'
      ... )
      >>> cfs(date_indices)
      array([[0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
          0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
          0., 0., 0., 0., 0., 0.]])
  
  Example use for using a squared exponential kernel:
  
      >>> kernel = squared_exponential_kernel(alpha=0.5)
      >>> cfs = CustomDateFeatureSet([pd.to_datetime('20191129', format='%Y%m%d'),
      ...                             pd.to_datetime('20200101', format='%Y%m%d')], kernel)
      >>> cfs(date_indices)
      array([[3.72665317e-06, 3.35462628e-04, 1.11089965e-02, 1.35335283e-01,
          6.06530660e-01, 1.00000000e+00, 6.06530660e-01, 1.35335283e-01,
          1.11089965e-02, 3.35462628e-04, 3.72665317e-06, 1.52299797e-08,
          0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
          0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
          0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
          0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
          0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
          1.52299797e-08, 3.72665317e-06, 3.35462628e-04, 1.11089965e-02,
          1.35335283e-01, 6.06530660e-01]])
class_docstr_tok: ["Implements","calculation","of","date","features",".","The","CustomDateFeatureSet","is","applied","on","a","pandas","Series","with","Datetimeindex","and","returns","a","1D","array","of","the","shape","(","1",",","len","(","date_indices",")",")",".","Note","that","for","lower","than","daily","granularity","the","distance","to","the","holiday","is","still","computed","on","a","per-day","basis",".","Example","use",":",">",">",">","import","pandas","as","pd",">",">",">","cfs","=","CustomDateFeatureSet","(","[","pd.to_datetime","(","'20191129","'",",","format=","'","%","Y","%","m","%","d","'",")",",","...","pd.to_datetime","(","'20200101","'",",","format=","'","%","Y","%","m","%","d","'",")","]",")",">",">",">","date_indices","=","pd.date_range","(","...","start=","''","2019-11-24","''",",","...","end=","''","2019-12-31","''",",","...","freq='D'","...",")",">",">",">","cfs","(","date_indices",")","array","(","[","[","0.",",","0.",",","0.",",","0.",",","0.",",","1.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0",".","]","]",")","Example","use","for","using","a","squared","exponential","kernel",":",">",">",">","kernel","=","squared_exponential_kernel","(","alpha=0.5",")",">",">",">","cfs","=","CustomDateFeatureSet","(","[","pd.to_datetime","(","'20191129","'",",","format=","'","%","Y","%","m","%","d","'",")",",","...","pd.to_datetime","(","'20200101","'",",","format=","'","%","Y","%","m","%","d","'",")","]",",","kernel",")",">",">",">","cfs","(","date_indices",")","array","(","[","[","3.72665317e-06",",","3.35462628e-04",",","1.11089965e-02",",","1.35335283e-01",",","6.06530660e-01",",","1.00000000e+00",",","6.06530660e-01",",","1.35335283e-01",",","1.11089965e-02",",","3.35462628e-04",",","3.72665317e-06",",","1.52299797e-08",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00",",","1.52299797e-08",",","3.72665317e-06",",","3.35462628e-04",",","1.11089965e-02",",","1.35335283e-01",",","6.06530660e-01","]","]",")"]
docstr: Parameters
  ----------
  reference_dates
      list of panda timestamps for which features should be created.
  kernel_function
      kernel function to pass the feature value based
      on distance in days. Can be indicator function (default),
      exponential_kernel, squared_exponential_kernel or user defined.
docstr_tok: ["Parameters","--","--","--","--","--","reference_dates","list","of","panda","timestamps","for","which","features","should","be","created",".","kernel_function","kernel","function","to","pass","the","feature","value","based","on","distance","in","days",".","Can","be","indicator","function","(","default",")",",","exponential_kernel",",","squared_exponential_kernel","or","user","defined","."]
code: def __init__(
      self,
      reference_dates: List[pd.Timestamp],
      kernel_function: Callable[[int], int] = indicator,
  ):
      """
      Parameters
      ----------
      reference_dates
          list of panda timestamps for which features should be created.
      kernel_function
          kernel function to pass the feature value based
          on distance in days. Can be indicator function (default),
          exponential_kernel, squared_exponential_kernel or user defined.
      """
      self.reference_dates = reference_dates
      self.kernel_function = kernel_function
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/pts/feature/holiday.py
imports: from typing import Callable, List
  import numpy
  import pandas
  from pandas.tseries.holiday import Holiday
  from gluonts.time_feature.holiday import indicator, distance_to_holiday
label_desc: Use image node_id 1 to create a new CustomDateFeatureSet object  with example: obj = CustomDateFeatureSet(reference_dates, kernel_function)