Skip to content

[ENH] Shift data validation out of ETS #3324

@TonyBagnall

Description

@TonyBagnall

Describe the feature or idea you want to propose

because we originally made ETS a standalone, user parameterised forecaster, we do all the validation internally. This is inefficient when searching, because it repeatedly does the same thing

Describe your proposed solution

Ultimately ETS can possibly be private and set through AutoETS. First I think switch

        error_type: int | str = 1,
        trend_type: int | str | None = 0,
        seasonality_type: int | str | None = 0,
        seasonal_period: int = 1,

to just be ints then remove this code which is called on every fit

        _validate_parameter(self.error_type, False)
        _validate_parameter(self.seasonality_type, True)
        _validate_parameter(self.trend_type, True)

        # Convert to string parameters to ints for numba efficiency
        def _get_int(x):
            if x is None:
                return 0
            if x == ADDITIVE:
                return 1
            if x == MULTIPLICATIVE:
                return 2
            return x

        self._error_type = _get_int(self.error_type)
        self._seasonality_type = _get_int(self.seasonality_type)
        self._trend_type = _get_int(self.trend_type)

validate just once in AutoETS

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Metadata

Metadata

Labels

enhancementNew feature, improvement request or other non-bug code enhancementforecastingForecasting package

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions