Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] Fix rocket transformers which document unequal length capability #2444

Open
maorgranot1 opened this issue Dec 12, 2024 · 15 comments · May be fixed by #2589
Open

[DOC] Fix rocket transformers which document unequal length capability #2444

maorgranot1 opened this issue Dec 12, 2024 · 15 comments · May be fixed by #2589
Assignees
Labels
documentation Improvements or additions to documentation transformations Transformations package

Comments

@maorgranot1
Copy link

maorgranot1 commented Dec 12, 2024

Describe the bug

Aeon's minirocket/multirocket wont support data of unequal length although it suppose to

The documentation states "Input data, any number of channels, equal length series of shape ( n_cases, n_channels, n_timepoints) or list of numpy arrays (any number of channels, unequal length series) of shape [n_cases], 2D np.array (n_channels, n_timepoints_i), where n_timepoints_i is length of series i", the class wont fit data of type list length N, containing np arrays of size (2XM[i]).

Steps/Code to reproduce the bug

import numpy as np
from aeon.transformations.collection.convolution_based import MiniRocket, MultiRocket

x = [np.random.rand(2,n) for n in np.floor(np.random.rand(100)*20).astype(int)+100]
y = np.round(np.random.rand(100)).astype(int)
print(f"x is a list of length {len(x)} containing np arrays of size {[data.shape for data in x]}")
print(f"y length is {y.shape}")

minirocket = MiniRocket(n_kernels=1000, random_state=42)
minirocket.fit(x, y) # result in fail because of unequal lengths

multirocket = MultiRocket(n_kernels=1000, random_state=42)
multirocket.fit(x, y) # result in fail because of unequal lengths

Expected results

no error is thrown

Actual results

image

Versions

python: 3.10.12 (main, Nov 6 2024, 20:22:13) [GCC 11.4.0]
executable: /usr/bin/python3
machine: Linux-6.1.85+-x86_64-with-glibc2.35
Python dependencies:
aeon: 1.0.0
pip: 24.1.2
setuptools: 75.1.0
scikit-learn: 1.5.2
numpy: 1.26.4
numba: 0.60.0
scipy: 1.13.1
pandas: 2.2.2

@maorgranot1 maorgranot1 added the bug Something isn't working label Dec 12, 2024
@baraline
Copy link
Member

baraline commented Dec 12, 2024

Thanks for adding the code to reproduce the issue. It seems that unequal length capability was removed in a previous version. So what you are experimenting is "normal" for the current version.

We can converts this issue into a enhancement one to implement this capability back when we retrieve the technical problems that caused this change before.

@MatthewMiddlehurst MatthewMiddlehurst added documentation Improvements or additions to documentation transformations Transformations package and removed bug Something isn't working labels Dec 12, 2024
@MatthewMiddlehurst MatthewMiddlehurst changed the title [BUG] minirocket doesn't support unequal-length [DOC] Fix rocket transformers which document unequal length capability Dec 12, 2024
@maorgranot1
Copy link
Author

Thanks for adding the code to reproduce the issue. It seems that unequal length capability was removed in a previous version. So what you are experimenting is "normal" for the current version.

We can converts this issue into a enhancement one to implement this capability back when we retrieve the technical problems that caused this change before.

so should it be labled as "documantion" and "enhancement"?

@baraline
Copy link
Member

Better keep this one as is and open another one for the enchancement. If you wish to create it go ahead, otherwise i'll do it in the evening.
Do you want to work on the issue of re-implementing it ?

@maorgranot1
Copy link
Author

Better keep this one as is and open another one for the enchancement. If you wish to create it go ahead, otherwise i'll do it in the evening. Do you want to work on the issue of re-implementing it ?

haha I'm afraid I'm not fluid enough in python to understand where does this loss of function accrued. Not to mention fix it..

@baraline
Copy link
Member

No worries ! I'll tag you in the issue if you didn't find time to create it before I do so you can keep track then.

@TonyBagnall
Copy link
Contributor

thanks for this, it is a general issue for all classifiers, we should make it clear in the base class fit that it only accepts list of unequal length numpy if "capability:unequal" is true

@TonyBagnall
Copy link
Contributor

hi @maorgranot1 can you point to the documentation you looked at? I suspect it was from an old version. The latest

https://www.aeon-toolkit.org/en/v1.0.0/api_reference/auto_generated/aeon.transformations.collection.convolution_based.Rocket.html#aeon.transformations.collection.convolution_based.Rocket.fit

has the text explaining about the tag values for capabilities.
image

@maorgranot1
Copy link
Author

hi @maorgranot1 can you point to the documentation you looked at? I suspect it was from an old version. The latest

https://www.aeon-toolkit.org/en/v1.0.0/api_reference/auto_generated/aeon.transformations.collection.convolution_based.Rocket.html#aeon.transformations.collection.convolution_based.Rocket.fit

has the text explaining about the tag values for capabilities. image

Second row after "Or list of numpy arrays..."

@TonyBagnall
Copy link
Contributor

ah ok, so need to more explicitly link the sentence with the secod paragraph that explains the constraints of list of numpy, thanks.

discussed unequal length with angus today and agreed on best way to handle it, more to follow

@Kaustbh
Copy link

Kaustbh commented Feb 16, 2025

Hi, is the issue open for a pull request, or is a decision still pending?

@MatthewMiddlehurst
Copy link
Member

Feel free to edit the documentation to make it more accurate

@Kaustbh
Copy link

Kaustbh commented Feb 25, 2025

@MatthewMiddlehurst I have made the PR, please review and let me know if any changes are needed.

@Kaustbh
Copy link

Kaustbh commented Mar 4, 2025

@aeon-actions-bot assign @Kaustbh

@Kaustbh
Copy link

Kaustbh commented Mar 5, 2025

Hi @MatthewMiddlehurst I noticed that when checking the documentation for MiniRocket.fit(), it displays the docstring from the BaseCollectionTransformer.fit() method rather than MiniRocket-specific details. However, MiniRocket does not explicitly define fit()—it only implements _fit().
Since fit() is inherited from BaseCollectionTransformer, it retains the base class's documentation, because of this reason I am adding the documentation for unequal-length in the Notes section of MiniRocket class docstring

@Kaustbh Kaustbh linked a pull request Mar 5, 2025 that will close this issue
5 tasks
@MatthewMiddlehurst
Copy link
Member

Ah, sorry I thought this was an issue in the minirocket docstring, not confusion from the generic fit/predict docstrings. Your first PR is more accurate, I will reopen and make a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation transformations Transformations package
Projects
None yet
5 participants