aeon-toolkit / aeon

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

[MNT] Replace assertions in networks module with raising Value errors #1956

Closed hadifawaz1999 closed 2 days ago

hadifawaz1999 commented 1 month ago

Describe the issue

In all networks module, the parameters handled as input lists have an assertion for the length of the list, but assertions are not a good idea, they should be replaced by raise ValueError message

Suggest a potential alternative/fix

Example

instead of:

assert len(self.strides) == self.n_conv_per_residual_block

It should be :

if len(self.strides) != self.n_conv_per_residual_block:
    raise ValueError(
        f"Number of strides {len(self.strides)} should be"
        f" the same as number of convolution layers per block but is"
        f" not: {self.n_conv_per_residual_block}."
    )

Additional context

No response

hadifawaz1999 commented 1 month ago

reserved issue

hadifawaz1999 commented 1 month ago

Aeon-Assign bot assign @JjmWeber

MatthewMiddlehurst commented 1 month ago

@aeon-actions-bot assign @JjmWeber

MatthewMiddlehurst commented 1 month ago

@aeon-actions-bot assign @hadifawaz1999

MatthewMiddlehurst commented 1 month ago

Ok looks like it wont let you add unrelated people to issues. Probably been abused in the past 🙂

hadifawaz1999 commented 1 month ago

yeah still requires a comment to be able to assign

JjmWeber commented 1 month ago

So here is my comment 😉