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: Transform a pandas series with timestamps to holiday features.
  
  Parameters
  ----------
  dates
      Pandas series with Datetimeindex timestamps.
docstr_tok: ["Transform","a","pandas","series","with","timestamps","to","holiday","features",".","Parameters","--","--","--","--","--","dates","Pandas","series","with","Datetimeindex","timestamps","."]
code: def __call__(self, dates):
      """
      Transform a pandas series with timestamps to holiday features.
  
      Parameters
      ----------
      dates
          Pandas series with Datetimeindex timestamps.
      """
      return np.vstack(
          [
              np.hstack(
                  [
                      self.kernel_function((index - ref_date).days)
                      for index in dates
                  ]
              )
              for ref_date in self.reference_dates
          ]
      ).sum(0, keepdims=True)
  
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 2 for calling the CustomDateFeatureSet obj's underlying member method code with example usage: obj.__call__(dates) and returns: np