-
Notifications
You must be signed in to change notification settings - Fork 208
[ENH] Add type hints for deep learning regression classes #2644
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for contributing to
|
All tests passed, |
I like this in principle, but I have no way to verify its correct currently that isn't too time-consuming given some of them are complex. If you could verify these are correct using |
@MatthewMiddlehurst and I found this error:
this is because in this code line 290
If callbacks is None, it will make Should I fix this? I can fix it by just modify this:
|
Nah i would ignore that one for now. Could you check the whole module? I am not 100% familiar with mypy but wouldnt |
I initially added --ignore-missing-imports to suppress errors related to missing library stubs, such as:
However, after removing --follow-imports=skip, I encountered a significant number of type-checking errors—most of which are unrelated to the scope of my PR. I’ve categorized these into seven distinct error types and provided explanations along with potential solutions in this Gist: But I don't know should I fix these or just ignore |
You only have to fix the ones in the regression deep learning files, my main concern is that it is capturing other files using these i.e. testing. If there are no errors other than the one you posted previously should be fine. |
Okay I have fixed just some other errors I encountered. You can review the last 2 commits if you want. Should be okay now, no errors in my files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change code without an explanation of why please considering this is a docs PR. This happens for verbose
.
Don't add types to variables, not at that point yet 🙂. The test is just to sanity check your changes, though it did not really work as expected.
@@ -1,5 +1,9 @@ | |||
"""Time Convolutional Neural Network (TimeCNN) regressor.""" | |||
|
|||
from __future__ import annotations | |||
|
|||
from typing import TYPE_CHECKING, Any, Literal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not have to be at the top, just the future import i believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I should import typing at the top, when imported it in if TYPE_CHECKING
, I got this error from pre-commit:
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
aeon/regression/deep_learning/_cnn.py:19:4: F821 undefined name 'TYPE_CHECKING'
This was a nice experiment but it has gotten a bit overly complex. mypy still does not work very well currently for our codebase it seems especially with complex types. You are welcome to continue trying to get these to fit, but I will note the original issue was for primitives and strings only. |
I have changed verbose from If it's not necessary to do that now, I'll change it back to bool
Okay, no worries, I'll fix that. Thanks for feedback |
Interesting to note, maybe worth creating an issue? Out of scope for this PR though yeah |
Sure, I'll do that after finishing this PR.. Sorry for those last errors 😅 I've deleted a line by mistake in |
@MatthewMiddlehurst Just a reminder if you have time to review it again. it should be good now. |
Reference Issues/PRs
#1454
What does this implement/fix? Explain your changes.
Added type hints for all deep learning classes in the
aeon/regression/deep_learning
directory.Does your contribution introduce a new dependency? If yes, which one?
No
Any other comments?
NaN
PR checklist
For all contributions
For new estimators and functions
__maintainer__
at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.For developers with write access