Skip to content

Convert TaskType Class to a TaskType Enum #951

Description

@PGijsbers

OpenML features different task types (e.g. classification, regression), which we map to integers through this class.
Since Python 3.4 added Enums to the language, so we can update our code!

In particular, we should:

  • convert the TaskType to an Enum
  • refactor the name (just TaskType is sufficient)
  • update every use and type hint and doc string where TaskType is an int to use the enum TaskType instead, for example here:
def create_task(
    task_type_id: TaskType,
    ...
)
  • bonus: make OpenMLTask.task_type (a string representation of the task type) based on the enum directly: if task_type is your stored TaskType enum variable, the string name is accessed with task_type.name.

This issue requires little knowledge of the modules, but might be a bit of work to find different spellings of task_type.
Make sure to use your IDE for renaming (e.g. shift+F6 in PyCharm on Windows) to rename all references to a variable at once!
Use find across multiple files (e.g. PyCharm ctrl+shift+F) through all files for terms like "task_type_id" to help find variables and documentation to update.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Good First IssueIssues suitable for people new to contributing to openml-python!

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions