Repository navigation
fix(tasks): infer task_type string from TaskType in create_task - #1767
Open
shellyco-code wants to merge 1 commit into
Open
shellyco-code wants to merge 1 commit into
shellyco-code wants to merge 1 commit into
Conversation
…ml#1766) - Add type_str property to TaskType enum mapping members to OpenML task strings - Resolve TODO in create_task() by passing task_type.type_str instead of hardcoded 'None' - Default task_type to task_type_id.type_str in OpenMLTask.__init__ if not provided - Add unit tests for task_type assignment and TaskType.type_str Signed-off-by: Shelly Chahar <shellychahar57@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1767 +/- ##
==========================================
- Coverage 81.50% 81.34% -0.16%
==========================================
Files 63 63
Lines 5238 5242 +4
==========================================
- Hits 4269 4264 -5
- Misses 969 978 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Metadata
Details
What does this PR implement/fix?
@property def type_str(self) -> strtoTaskTypemapping each enum member to its canonical OpenML string name (e.g.,"Supervised Classification","Supervised Regression","Clustering","Learning Curve", etc.).# TODO: refactor to get task type string from ID.inopenml/tasks/functions.py:create_taskby passingtask_type=task_type.type_strtotask_cls.OpenMLTask.__init__defaultsself.task_type = task_type if task_type is not None else task_type_id.type_str.test_create_task_sets_task_type()andtest_task_type_str()intests/test_tasks/test_task_functions.py.Why is this change necessary?
Previously, any task created via
create_task()receivedtask_type="None"as a literal string. This caused checks liketask.task_type == "Supervised Classification"to fail and resulted in representations and error messages outputting'None'.How can I reproduce the issue this PR is solving and its solution?
Run
pytest tests/test_tasks/test_task_functions.py -k "test_create_task_sets_task_type or test_task_type_str". Both tests pass offline in < 0.2s.