aeon-toolkit / aeon

A toolkit for machine learning from time series
https://aeon-toolkit.org/
BSD 3-Clause "New" or "Revised" License
979 stars 116 forks source link

[ENH] AutocorrelationFunctionTransformer default lag #1747

Open TonyBagnall opened 3 months ago

TonyBagnall commented 3 months ago

The AutocorrelationFunctionTransformer has a default lag of 100, and if you pass a series shorter than 100 it simply fails. Its not a bug because it tells you why its failed, but I think it should behave more sensibly, not least because otherwise all testing on all collection transformers will need to be on length 100 series.

Steps/Code to reproduce

from aeon.testing.data_generation import make_example_3d_numpy
from aeon.transformations.collection import AutocorrelationFunctionTransformer
X,y = make_example_3d_numpy(n_timepoints=30)
t = AutocorrelationFunctionTransformer()
t.fit_transform(X,y)
t.fit(X)

Expected results

I think if the default lag should be set to None, then if not set by the user set to length/4. Long lag ACF are fairly meaningless.

Actual results

  File "C:\Code\aeon\aeon\transformations\collection\acf.py", line 75, in _transform
    raise ValueError(
ValueError: lags (30) must be smaller than n_timepoints - 1 (29).

Process finished with exit code 1

Versions

No response