aeon
aeon copied to clipboard
[BUG] `BaseCollectionEstimator` `_check_X` does not raise an error for different number of channels
Describe the bug
_check_X checks whether a data collection is valid, but does not catch datasets which have a different number of channels for each case which is unsupported.
Steps/Code to reproduce the bug
import numpy as np
import pytest
from aeon.base import BaseCollectionEstimator
dummy = BaseCollectionEstimator()
all_tags = {
"capability:multivariate": True,
"capability:unequal_length": True,
"capability:missing_values": True,
}
dummy.set_tags(**all_tags)
X = [np.random.random(size=(2, 10)), np.random.random(size=(3, 10))]
with pytest.raises(Exception):
dummy._check_X(X)
Expected results
An informative exception is rasied.
Actual results
No exception is raised.
Versions
No response
@aeon-actions-bot assign @Cyril-Meyer
@MatthewMiddlehurst I got some questions you may have answers to :
-
Currently, the function getting the number of chan is
get_n_channelswhich "return the number of ~~timepoints~~ channels in the first element of a collectiom".get_n_channelsis used here and here. Can we transform this function with a parameters like get_n_channels(X, onlyFirst=True) to have the hability to get list of channels ? -
_check_Xis the function which is supposed to check input, but_get_X_metadata(called by_check_X) is the function calling effectivelyget_n_channels. Can we raise the exception from here ? (note that it is also used in_convert_X) -
I've found multiple reference to
aeon.registry.COLLECTIONS_DATA_TYPESin the doc, and replaced them withaeon.utils.registry.COLLECTIONS_DATA_TYPESas that's where I founded them. We may want to create an issue about this ? Was it a mistake from me ?
PS : when I ask "can we", it is to be understood as : "is it a good idea ?"
@Cyril-Meyer
- I think your merged resolution is fine. We don't support different number of channels, so just raising an error instead of adding a parameter is ok.
- It will go through
_check_Xfirst, as long as the error is informative so the user knows what the issue is I'm ok with it going wherever, I think that has been achieved. - Thanks for the fixes 🙂. Probably don't need an issue unless you know there are more that still need to be fixed.
looks like #1895 fixed this, can we close @Cyril-Meyer ?
looks like #1895 fixed this, can we close @Cyril-Meyer ?
I think we can if @MatthewMiddlehurst approve 😄