Skip to content

[Feature Extraction] Allow using non numba-based custom features #494

@mbignotti

Description

@mbignotti

Description

It would be nice being able to use custom lag transformations that do not rely on numba.
For example, I was exploring the usage of the catch 22 features. The implementation would be straightforward:

import pycatch22
import numpy as np

def rolling_co_trev_1_num(x: np.ndarray, window_size: int) -> np.ndarray:
    n = len(x)
    result = np.empty(n)
    result[:] = np.nan
    for i in range(window_size - 1, n):
        window = x[i - window_size + 1 : i + 1]
        feat = pycatch22.CO_trev_1_num(window.tolist())
        result[i] = feat
    return result

if __name__ == "__main__":
    print(rolling_co_trev_1_num(np.random.randint(10, 100, 100), 20))

However, I cannot use this function with the MLForecast class since numba cannot compile it (due to the usage of the pycatch22 module inside the function).

Use case

Expand the range of allowed lag transformations in the MLForecast class, thus opening the path to (hopefully) more accurate machine learning forecasting models.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions