pyhealth.tasks.ChestXray14MultilabelClassification#

class pyhealth.tasks.ChestXray14MultilabelClassification(code_mapping=None)[source]#

Bases: BaseTask

A PyHealth task class for multilabel classification of all fourteen diseases in the ChestXray14 dataset.

task_name#

The name of the task.

Type:

str

input_schema#

The schema for the task input.

Type:

Dict[str, str]

output_schema#

The schema for the task output.

Type:

Dict[str, str]

Examples

>>> from pyhealth.datasets import ChestXray14Dataset
>>> from pyhealth.tasks import ChestXray14MultilabelClassification
>>> dataset = ChestXray14Dataset(root="/path/to/chestxray14")
>>> task = ChestXray14MultilabelClassification()
>>> samples = dataset.set_task(task)

Initialize a task with optional code mapping.

Parameters:

code_mapping (Optional[Dict[str, Tuple[str, str]]]) –

optional dict mapping feature keys to (source_vocab, target_vocab) tuples. For example:

code_mapping={
    "conditions": ("ICD9CM", "CCSCM"),
    "procedures": ("ICD9PROC", "CCSPROC"),
    "drugs": ("NDC", "ATC"),
}

When provided, the corresponding input_schema entries are upgraded from "sequence" to ("sequence", {"code_mapping": (src, tgt)}) so that the SequenceProcessor maps raw codes at fit/process time.

task_name: str = 'ChestXray14MultilabelClassification'#
input_schema: Dict[str, str] = {'image': 'image'}#
output_schema: Dict[str, str] = {'labels': 'multilabel'}#
__init__(code_mapping=None)#

Initialize a task with optional code mapping.

Parameters:

code_mapping (Optional[Dict[str, Tuple[str, str]]]) –

optional dict mapping feature keys to (source_vocab, target_vocab) tuples. For example:

code_mapping={
    "conditions": ("ICD9CM", "CCSCM"),
    "procedures": ("ICD9PROC", "CCSPROC"),
    "drugs": ("NDC", "ATC"),
}

When provided, the corresponding input_schema entries are upgraded from "sequence" to ("sequence", {"code_mapping": (src, tgt)}) so that the SequenceProcessor maps raw codes at fit/process time.

pre_filter(df)#
Return type:

LazyFrame