Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#1,766 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@shellyco-code ci sta già lavorando.

Dal 6/10/2026.

  • #1767 di @shellyco-code — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
80/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
api

Direzione di ricerca

Inizia in openml/tasks/functions.py, in create_task() intorno alla riga 575, poi leggi come i valori di TaskType vengono mappati ai nomi canonici. Controlla il confronto del tipo di task in tests/test_runs/test_run.py intorno alla riga 290 e aggiungi o aggiorna un test di regressione. Il lavoro è completo quando un task creato localmente espone la stringa canonica prevista per il tipo di task invece di "None".

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
366
Fork
306
Merge medio
2g 9h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openml/openml-python

Tutte le issue di openml/openml-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.