def set_params(self,
                   continent: Optional[str] = None,
                   country: Optional[str] = None,
                   features: Optional[List[CalendarFeature]] = None):
        """ Set parameters of the calendar extraction processing step.

        :param continent: Continent where the country or region is located
                          (important for importing calendar module).
        :type continent: str
        :param country: Country or region to use for holiday calendar (default 'Germany')
        :type country: str
        :param features: A list, which contains all features that should be calculated. Default all are calculated.
        :type features: List[str]
        :raises AttributeError: If 'continent' and/or 'country' is invalid.
        """

        if continent is not None:
            self.continent = continent
        if country is not None:
            self.country = country
        if features is not None:
            self.features: List[CalendarFeature] = features
        try:
            self.calendar = _init_calendar(self.continent, self.country)
        except UtilException as e:
            raise WrongParameterException(
                e.message, "Please set a valid country or continent for.",
                CalendarExtraction)
Beispiel #2
0
    def __init__(self,
                 name: str = None,
                 window_size=24 * 7,
                 window_size_unit="d",
                 group_by: RollingGroupBy = RollingGroupBy.No,
                 continent: str = "Europe",
                 country: str = "Germany",
                 closed="left"):

        super().__init__(name if name is not None else self.__class__.__name__)
        self.window_size = window_size
        self.group_by = group_by
        self.window_size_unit = window_size_unit
        self.country = country
        self.continent = continent
        self.closed = closed
        self.cal = _init_calendar(self.continent, self.country)
Beispiel #3
0
    def __init__(self,
                 name: str = "RollingMean",
                 window_size=24 * 7,
                 window_size_unit="d",
                 group_by: RollingGroupBy = RollingGroupBy.No,
                 continent: str = "Europe",
                 country: str = "Germany",
                 closed="left"):

        super().__init__(name)
        self.window_size = window_size
        self.window_size_unit = "d"
        self.group_by = group_by
        self.window_size_unit = window_size_unit
        self.country = country
        self.continent = continent
        self.closed = closed
        self.cal = _init_calendar(self.continent, self.country)
    def __init__(self,
                 name: str = "CalendarExtraction",
                 continent: str = "Europe",
                 country: str = "Germany",
                 features: Optional[List[CalendarFeature]] = None):

        super().__init__(name)
        self.continent = continent
        self.country = country
        try:
            self.calendar = _init_calendar(self.continent, self.country)
        except UtilException as e:
            raise WrongParameterException(
                e.message, "Please set a valid country or continent for.",
                CalendarExtraction)

        if features is None:
            self.features: List[CalendarFeature] = [
                CalendarFeature.month, CalendarFeature.day,
                CalendarFeature.hour, CalendarFeature.weekday
            ]
        else:
            self.features: List[CalendarFeature] = features
Beispiel #5
0
 def set_params(self,
                window_size: Optional[int] = None,
                window_size_unit: Optional[str] = None,
                group_by: Optional[RollingGroupBy] = None,
                continent: Optional[str] = None,
                country: Optional[str] = None,
                closed: Optional[str] = None):
     """
     Set parameters of the rolling mean
     :param window_size: Window size for which to calculate the mean
     :type window_size: int
     :param window_size_unit: Unit of the window size (default: "d" [day])
     :type window_size_unit: str
     :param groupy_by: how the entries of the time series should be grouped
     :type group_by. RollingGroupBy
     :param continent: If group_by is WorkdayAndHoliday: Continent where the country or region is located
                       (important for importing calendar module).
     :type continent: str
     :param country: If group_by is WorkdayAndHoliday: Country or region to use for holiday calendar (default 'Germany')
     :type country: str
     :param closed: If there array is closed left or right
     :type closed: str
     """
     if window_size:
         self.window_size = window_size
     if window_size_unit:
         self.window_size_unit = window_size_unit
     if group_by:
         self.group_by = group_by
     if closed:
         self.closed = closed
     if continent:
         self.continent = continent
     if country:
         self.country = country
     self.cal = _init_calendar(self.continent, self.country)