aeon icon indicating copy to clipboard operation
aeon copied to clipboard

[ENH] Output shape of transformed series when returning numpy arrays

Open TonyBagnall opened this issue 10 months ago • 0 comments

Describe the feature or idea you want to propose

classes that extend with BaseSeriesTransformer are mostly designed to work with np.ndarrays (see later issue for pandas discussion). I have added a postprocess function to call after transform that makes sure the returned data has the same axis as that passed, if the user passes in an axis argument (where axis == 0 means (n_channels, n_timepoints) and axis == 1 means (n_timepoints, n_channels). This raises this associated issue

1. If the user passes a 1D single channel series, should we return a 1D transformed series?

Personally I think yes, but discussion on slack indicates others think we should stick to 2D always. A complication is for transformers that only handle univariate (i.e. capability:multivariate is false). These only work with 1D array, and return 1D arrays.

Whatever we decide, we need to document and make it very clear what behaviour to expect.

Describe your proposed solution

If the user passes a 1D single channel np.ndarray, should we return a 1D transformed series? Option 1: if passed 1D numpy shape (10,), convert back to 1D in the BaseSeriesTransformer Option 2: If passed a 1D numpy always return a 2D numpy of shape (1,10) or (10,1) Option 3 (current state): If capability:multivariate is true, return 2D numpy, if false return 1D numpy.

feel free to add alternatives here

Describe alternatives you've considered, if relevant

No response

Additional context

No response

TonyBagnall avatar Apr 07 '24 10:04 TonyBagnall