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

[ENH] Type hints for primitives and string arguments #1454

Open
TonyBagnall opened this issue Apr 22, 2024 · 9 comments · Fixed by #1472
Open

[ENH] Type hints for primitives and string arguments #1454

TonyBagnall opened this issue Apr 22, 2024 · 9 comments · Fixed by #1472
Labels
enhancement New feature, improvement request or other non-bug code enhancement good first issue Good for newcomers

Comments

@TonyBagnall
Copy link
Contributor

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

@TonyBagnall TonyBagnall added enhancement New feature, improvement request or other non-bug code enhancement good first issue Good for newcomers labels Apr 22, 2024
@nileenagp
Copy link
Contributor

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.

@nileenagp
Copy link
Contributor

@all-contributors please add @nileenagp for Code

Copy link
Contributor

@nileenagp

I've put up a pull request to add @nileenagp! 🎉

@nileenagp
Copy link
Contributor

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?

@MatthewMiddlehurst
Copy link
Member

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.

@nileenagp
Copy link
Contributor

Thanks for the confirmation, I will leave that type hint for now.

@YashviMehta03
Copy link

YashviMehta03 commented Nov 16, 2024

Hello @TonyBagnall , is this issue still open to work on ?
I would like to work on it , could you please assign it.

Thank you!

@MatthewMiddlehurst
Copy link
Member

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.

@YashviMehta03
Copy link

YashviMehta03 commented Dec 19, 2024

Hello @MatthewMiddlehurst , yes right.
So to start with, these are the modules where I could add type hints since they are missing :

  1. all the .py files under the following directories :
    aeon/classification/convolution_based
    aeon/classification/feature_based

  2. this particular file
    aeon/classification/early_classification/_probability_threshold.py

I would like to work on it , could you assign it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, improvement request or other non-bug code enhancement good first issue Good for newcomers
Projects
None yet
4 participants