Skip to content

Conversation

@Omswastik-11
Copy link

Fixes #1578

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes a key part of the public API.

Please do not introduce breaking changes in refactors.

@Omswastik-11
Copy link
Author

Hi @fkiraly !!
Thanks for suggestion . I reverted the changes that affect public API .

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()

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Omswastik-11 Omswastik-11 requested a review from fkiraly January 1, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNT] Reduce Task Constructor Duplication

2 participants