Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

[BUG] create_task() hardcodes task_type="None" instead of inferring type string from TaskType

未關閉 適合新手
#1,766 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@shellyco-code 已經在處理了。

開始於 2026年10月6日。

  • #1767 來自 @shellyco-code —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
80/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
api

研究方向

從 openml/tasks/functions.py 中第 575 行附近的 create_task() 開始,接著閱讀 TaskType 值如何對應到標準名稱。檢查 tests/test_runs/test_run.py 中第 290 行附近的任務類型比較,並新增或更新回歸測試。完成的標準是:本機建立的任務會顯示預期的標準任務類型字串,而不是 "None"。

由索引模型根據 Issue 內容生成。

描述

Description

When creating an OpenML task locally using openml.tasks.create_task(), the task object is initialized with task_type="None".

In openml/tasks/functions.py:575, the function hardcodes this placeholder string literal:

return task_cls(
    task_id=None,
    task_type_id=task_type,
    task_type="None",  # TODO: refactor to get task type string from ID.
    data_set_id=dataset_id,
    target_name=target_name,
    estimation_procedure_id=estimation_procedure_id,
    evaluation_measure=evaluation_measure,
    **kwargs,
)
Because of this, task.task_type is literally the string "None" rather than the canonical task type name (e.g., "Supervised Classification", "Supervised Regression", "Clustering", "Learning Curve").

This causes:

Equality checks like if task.task_type == "Supervised Classification" (used in client code and in tests/test_runs/test_run.py:290) to evaluate to False.
Error messages and representations to display Task type 'None' (such as in openml/tasks/task.py:315).
Steps/Code to Reproduce
python
import openml
from openml.tasks import TaskType, create_task
task = create_task(
    TaskType.SUPERVISED_CLASSIFICATION,
    dataset_id=1,
    target_name="class",
    estimation_procedure_id=1,
)
print("task.task_type:", repr(task.task_type))
print("Is Supervised Classification?", task.task_type == "Supervised Classification")
Expected Results
task.task_type should be "Supervised Classification", and task.task_type == "Supervised Classification" should evaluate to True.

Actual Results
task.task_type: 'None'
Is Supervised Classification? False
Versions
OpenML: 0.16.0
Python: 3.10+
OS: Windows / Linux / macOS
主要語言
Python
星號
366
分支
308
平均合併
1 天 16 小時
30 天內合併 PR
7

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

openml/openml-python 的其他 Issue

查看 openml/openml-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。