class_docstr: Implements calculation of holiday features. The CustomHolidayFeatureSet is
  applied on a pandas Series with Datetimeindex and returns a 2D array of
  the shape (len(dates), num_features), where num_features are the number
  of holidays.
  
  Note that for lower than daily granularity the distance to the holiday is
  still computed on a per-day basis.
  
  Example use:
  
      >>> from pts.features import (
      ...    squared_exponential_kernel,
      ...    SpecialDateFeatureSet,
      ...    CHRISTMAS_DAY,
      ...    CHRISTMAS_EVE
      ... )
      >>> import pandas as pd
      >>> from pandas.tseries.holiday import Holiday
      >>> cfs = CustomHolidayFeatureSet([Holiday("New Years Day", month=1, day=1), Holiday("Christmas Day", month=12, day=25)])
      >>> date_indices = pd.date_range(
      ...     start="2016-12-24",
      ...     end="2016-12-31",
      ...     freq='D'
      ... )
      >>> cfs(date_indices)
      array([[1., 0., 0., 0., 0., 0., 0., 0.],
             [0., 1., 0., 0., 0., 0., 0., 0.]])
  
  Example use for using a squared exponential kernel:
  
      >>> kernel = squared_exponential_kernel(alpha=1.0)
      >>> sfs = SpecialDateFeatureSet([Holiday("New Years Day", month=1, day=1), Holiday("Christmas Day", month=12, day=25)], kernel)
      >>> sfs(date_indices)
      array([[1.00000000e+00, 3.67879441e-01, 1.83156389e-02, 1.23409804e-04,
              1.12535175e-07, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
             [3.67879441e-01, 1.00000000e+00, 3.67879441e-01, 1.83156389e-02,
              1.23409804e-04, 1.12535175e-07, 0.00000000e+00, 0.00000000e+00]])
class_docstr_tok: ["Implements","calculation","of","holiday","features",".","The","CustomHolidayFeatureSet","is","applied","on","a","pandas","Series","with","Datetimeindex","and","returns","a","2D","array","of","the","shape","(","len","(","dates",")",",","num_features",")",",","where","num_features","are","the","number","of","holidays",".","Note","that","for","lower","than","daily","granularity","the","distance","to","the","holiday","is","still","computed","on","a","per-day","basis",".","Example","use",":",">",">",">","from","pts.features","import","(","...","squared_exponential_kernel",",","...","SpecialDateFeatureSet",",","...","CHRISTMAS_DAY",",","...","CHRISTMAS_EVE","...",")",">",">",">","import","pandas","as","pd",">",">",">","from","pandas.tseries.holiday","import","Holiday",">",">",">","cfs","=","CustomHolidayFeatureSet","(","[","Holiday","(","``","New","Years","Day","''",",","month=1",",","day=1",")",",","Holiday","(","``","Christmas","Day","''",",","month=12",",","day=25",")","]",")",">",">",">","date_indices","=","pd.date_range","(","...","start=","''","2016-12-24","''",",","...","end=","''","2016-12-31","''",",","...","freq='D'","...",")",">",">",">","cfs","(","date_indices",")","array","(","[","[","1.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0",".","]",",","[","0.",",","1.",",","0.",",","0.",",","0.",",","0.",",","0.",",","0",".","]","]",")","Example","use","for","using","a","squared","exponential","kernel",":",">",">",">","kernel","=","squared_exponential_kernel","(","alpha=1.0",")",">",">",">","sfs","=","SpecialDateFeatureSet","(","[","Holiday","(","``","New","Years","Day","''",",","month=1",",","day=1",")",",","Holiday","(","``","Christmas","Day","''",",","month=12",",","day=25",")","]",",","kernel",")",">",">",">","sfs","(","date_indices",")","array","(","[","[","1.00000000e+00",",","3.67879441e-01",",","1.83156389e-02",",","1.23409804e-04",",","1.12535175e-07",",","0.00000000e+00",",","0.00000000e+00",",","0.00000000e+00","]",",","[","3.67879441e-01",",","1.00000000e+00",",","3.67879441e-01",",","1.83156389e-02",",","1.23409804e-04",",","1.12535175e-07",",","0.00000000e+00",",","0.00000000e+00","]","]",")"]
docstr: Parameters
  ----------
  feature_names
      list of strings with holiday names 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","--","--","--","--","--","feature_names","list","of","strings","with","holiday","names","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,
      custom_holidays: List[Holiday],
      kernel_function: Callable[[int], int] = indicator,
  ):
      """
      Parameters
      ----------
      feature_names
          list of strings with holiday names 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.custom_holidays = custom_holidays
      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 CustomHolidayFeatureSet object  with example: obj = CustomHolidayFeatureSet(custom_holidays, kernel_function)