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

[MNT] Tags using enums #2235

Open
chrisholder opened this issue Oct 21, 2024 · 0 comments
Open

[MNT] Tags using enums #2235

chrisholder opened this issue Oct 21, 2024 · 0 comments
Labels
enhancement New feature, improvement request or other non-bug code enhancement

Comments

@chrisholder
Copy link
Contributor

Describe the feature or idea you want to propose

In aeon we use the _tags to define the capabilities. For examples:

    _tags = {
        "X_inner_type": ["np-list", "numpy3D"],
        "capability:multivariate": True,
        "capability:unequal_length": True,
        "capability:multithreading": True,
        "algorithm_type": "feature",
    }

For values like "algorithm_type" and "X_inner_type" which we use a string value for it would be nice if these were defined with enums.

Describe your proposed solution

Add an enum for each tag form example:

from enum import Enum

class AlgorithmTypeTag(Enum):
    FEATURE = "feature"
    DISTANCE = "distance"
    DICTIONARY = "dictionary"
    HYBRID = "hybrid"
    INTERVAL = "interval"
    CONVOLUTION = "convolution"
    SHAPELET = "shapelet"
    DEEPLEARNING = "deeplearning"

Assuming we had a enum for each type we could then do something like this:

    _tags = {
        "X_inner_type": [InnerTypeTag.NP_LIST, InnerTypeTag.NUMPY3D],
        "capability:multivariate": True,
        "capability:unequal_length": True,
        "capability:multithreading": True,
        "algorithm_type": AlgorithmTypeTag.FEATURE,
    }

As the values of the enums that they resolve to are the same string values it means we don't need to change any of the actual tag logic. Additionally we can better assert the tag is valid by checking if a value is an instance for Enum.

Describe alternatives you've considered, if relevant

No response

Additional context

No response

@chrisholder chrisholder added the enhancement New feature, improvement request or other non-bug code enhancement label Oct 21, 2024
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
Projects
None yet
Development

No branches or pull requests

1 participant