aeon
aeon copied to clipboard
[ENH] Type hints for primitives and string arguments
Describe the feature or idea you want to propose
we would like to increase the use of type hints, and a good first issue is to add them for the simplest case when arguments are primitives (int, float, bool) or strings. Pick a package, look through the code and add type hints. Just for primitives for now, more complex types need a bit of thought. Many have npt.ArrayLike types, but we have not decided on standardising on that, so leave these alone. Dont feel you have to do them all, this is a good first issue to get you started.
Describe your proposed solution
for example, the constructor for the anomaly detection algorithm STRAY has these type hints
def __init__(
self,
alpha: float = 0.01,
k: int = 10,
knn_algorithm: str = "brute",
p: float = 0.5,
size_threshold: int = 50,
outlier_tail: str = "max",
):
but the segmentation algorithm CLASP does not
def _is_trivial_match(candidate, change_points, n_timepoints, exclusion_radius=0.05):
"""Check if a candidate change point is in close proximity to other change points.
Describe alternatives you've considered, if relevant
No response
Additional context
No response
Hello,
I would like to start on this issue. I am taking up "aeon.classification.distance_based._time_series_neighbors.py" script to start with.
@all-contributors please add @nileenagp for Code
Hello, I have a doubt here. If I need to use Type[keras.optimizers.Optimizer] in type hints for a parameter, Is it allowed to import "keras" as per the project standards, when it is not required anywhere else in the script?
No, if the dependency is optional it should not be imported at the top level of a file. This would exclude it from specific type hints like that I imagine.
Thanks for the confirmation, I will leave that type hint for now.
Hello @TonyBagnall , is this issue still open to work on ? I would like to work on it , could you please assign it.
Thank you!
Hi @YashviMehta03, this one is a bit too big for a single person really. I would post here selecting a part of the package you want to add type hints too and go from there.
Hello @MatthewMiddlehurst , yes right. So to start with, these are the modules where I could add type hints since they are missing :
-
all the .py files under the following directories : aeon/classification/convolution_based aeon/classification/feature_based
-
this particular file aeon/classification/early_classification/_probability_threshold.py
I would like to work on it , could you assign it?
@YashviMehta03 feel free to open a PR
Hello @TonyBagnall , I would like to work on this issue. I'll start with the aeon/segmentation/_clasp.py script. Could you please assign it? Thank you!
Hi not going to assign this since it's a large issue people are taking on incrementally but feel free to open a PR.