[MNT] Remove redundant __init__ by adding ClassVar#1588
[MNT] Remove redundant __init__ by adding ClassVar#1588Omswastik-11 wants to merge 14 commits intoopenml:mainfrom
Conversation
fkiraly
left a comment
There was a problem hiding this comment.
This changes a key part of the public API.
Please do not introduce breaking changes in refactors.
|
Hi @fkiraly !! from openml.tasks.task import (
OpenMLClassificationTask,
OpenMLRegressionTask,
OpenMLClusteringTask,
OpenMLLearningCurveTask,
TaskType,
)
def main():
# Classification (defaults estimation_procedure_id=1)
cls_task = OpenMLClassificationTask(
task_id=None,
task_type_id=TaskType.SUPERVISED_CLASSIFICATION,
task_type="Supervised Classification",
data_set_id=1,
target_name="class",
)
print("Classification est proc:", cls_task.estimation_procedure_id)
# Regression (defaults estimation_procedure_id=7)
reg_task = OpenMLRegressionTask(
task_id=None,
task_type_id=TaskType.SUPERVISED_REGRESSION,
task_type="Supervised Regression",
data_set_id=2,
target_name="target",
)
print("Regression est proc:", reg_task.estimation_procedure_id)
# Clustering (defaults estimation_procedure_id=17)
clu_task = OpenMLClusteringTask(
task_id=None,
task_type_id=TaskType.CLUSTERING,
task_type="Clustering",
data_set_id=3,
)
print("Clustering est proc:", clu_task.estimation_procedure_id)
# Learning curve (defaults estimation_procedure_id=13)
lc_task = OpenMLLearningCurveTask(
task_id=None,
task_type_id=TaskType.LEARNING_CURVE,
task_type="Learning Curve",
data_set_id=4,
target_name="class",
)
print("Learning curve est proc:", lc_task.estimation_procedure_id)
if __name__ == "__main__":
main() |
fkiraly
left a comment
There was a problem hiding this comment.
Looks ok, two main requests:
- do not delete the variables from the docstring, they are still valid
- there are task specific variables which imo should remain with the specific task class
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1588 +/- ##
==========================================
+ Coverage 52.08% 53.13% +1.05%
==========================================
Files 36 36
Lines 4360 4364 +4
==========================================
+ Hits 2271 2319 +48
+ Misses 2089 2045 -44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
openml/tasks/task.py
Outdated
| data_splits_url: str | None = None, | ||
| task_id: int | None = None, | ||
| ): | ||
| resolved_estimation_procedure_id = self._resolve_estimation_procedure_id( |
There was a problem hiding this comment.
why is this needed? Does not seem DRY.
There was a problem hiding this comment.
ahh thanks for pointing . I will fix this .
fkiraly
left a comment
There was a problem hiding this comment.
OpenMLSupervisedTask inherits OpenMLTask, both call _resolve_estimation_procedure_id which seems like a failure of DRYness through inheritance. Can you kindly explain, or fix?
Fixes #1578