You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
defcreate_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.
Thanks for assigning it to me. I have started working on it.
I am failing a few tests now. Right now, there is an issue where I get this error ValueError: 9 is not a valid TaskType
Look like some of the values in proc_["oml:ttid"]) is 9, when I run the test tests/test_tasks/test_task_functions.py.
And nothing is mapped to 9 in TaskType.
What do you suggest I do about this? Is something supposed to be mapped to 9?
Cool! 9 is not a valid task type id (based on rest API docs, which I assume is up to date @sahithyaravi1493?).
Can you tell me what the proc_["oml:type"] and proc_["oml:id"] values are of the proc_ that causes the failure?
Sorry for the delay. It turns out it is MultitaskRegression. It's odd that the name does not match with your observed values. For now just add "multitask regression" to the enum. I'll need a bit more information (from other devs) to decide what the right course of action should be. I don't think setting the task_type_id to None is correct here, an explicit error is probably preferred if the task type is truly unknown.
@janvanrijn It looks like you are the creator of the "Multitask Regression" task type. Why is it only on the test server? If there are no plans to have it on the live server, is it possible to remove it from the test server? There are no tasks currently associated with the task type on the test server (according to this query).
Hey I've made a pr. I think I covered all usage of the class.
I made the changes you said, I added a MULTITASK_REGRESSION field in the enum and mapped it to 9.
Tell me if there are any issues or something I need to change.
Activity
[-]Convert TaskType class to a TaskTypeEnum[/-][+]Convert TaskType Class to a TaskType Enum[/+]fsabr commentedon Oct 1, 2020
Hey can I take this up?
PGijsbers commentedon Oct 1, 2020
Absolutely! I assigned you to this issue now 👍 let us know if you need help, otherwise we are looking forward to a PR!
fsabr commentedon Oct 2, 2020
Thanks for assigning it to me. I have started working on it.
I am failing a few tests now. Right now, there is an issue where I get this error
ValueError: 9 is not a valid TaskTypeLook like some of the values in
proc_["oml:ttid"])is 9, when I run the testtests/test_tasks/test_task_functions.py.And nothing is mapped to 9 in TaskType.
What do you suggest I do about this? Is something supposed to be mapped to 9?
PGijsbers commentedon Oct 2, 2020
Cool! 9 is not a valid task type id (based on rest API docs, which I assume is up to date @sahithyaravi1493?).
Can you tell me what the
proc_["oml:type"]andproc_["oml:id"]values are of theproc_that causes the failure?fsabr commentedon Oct 2, 2020
Wait, there's only one faulty proc. Here,
Btw, if I make task_type_id
Nonewhen there is no mapping in TaskType, all the tests pass.PGijsbers commentedon Oct 2, 2020
Sorry for the delay. It turns out it is
MultitaskRegression. It's odd that the name does not match with your observed values. For now just add "multitask regression" to the enum. I'll need a bit more information (from other devs) to decide what the right course of action should be. I don't think setting thetask_type_idtoNoneis correct here, an explicit error is probably preferred if the task type is truly unknown.@janvanrijn It looks like you are the creator of the "Multitask Regression" task type. Why is it only on the test server? If there are no plans to have it on the live server, is it possible to remove it from the test server? There are no tasks currently associated with the task type on the test server (according to this query).
fsabr commentedon Oct 2, 2020
Hey I've made a pr. I think I covered all usage of the class.
I made the changes you said, I added a
MULTITASK_REGRESSIONfield in the enum and mapped it to 9.Tell me if there are any issues or something I need to change.