pyhealth.tasks.mpf_clinical_prediction#

Multitask Prompted Fine-tuning (MPF) style binary clinical prediction on FHIR token timelines, paired with FHIRDataset and EHRMambaCEHR. Based on CEHR / EHRMamba ideas (EHRMamba, arXiv:2405.14567): https://arxiv.org/abs/2405.14567.

class pyhealth.tasks.MPFClinicalPredictionTask(max_len=512, use_mpf=True)[source]#

Bases: BaseTask

Binary mortality prediction from FHIR CEHR sequences with optional MPF tokens.

The task does timeline extraction and emits raw per-event lists, including concept keys as strings. Tokenization is the CehrProcessor’s job, fit during the standard SampleBuilder.fit(dataset) pass.

max_len#

Output sequence length (must be >= 2 for boundary tokens).

use_mpf#

If True, prepend <mor> to the sequence; else <cls>. The closing <reg> is always emitted.

task_name: str = 'MPFClinicalPredictionFHIR'#
output_schema: Dict[str, str] = {'label': 'binary'}#
input_schema: Dict[str, Any]#
pre_filter(df)#
Return type:

LazyFrame