|
15 | 15 | warnings.filterwarnings('ignore') |
16 | 16 |
|
17 | 17 | class Data(Dataset): |
| 18 | + ''' |
| 19 | + wrapper for PhysioNet 2012 dataset implemented in tsdm |
| 20 | + tsdm: https://openreview.net/forum?id=a-bD9-0ycs0 |
| 21 | +
|
| 22 | + - tasks: forecasting |
| 23 | + - sampling rate (rounded): 1 hour |
| 24 | + - max time length (padded): 48 (48 hours) |
| 25 | + - seq_len -> pred_len: |
| 26 | + - 36 -> 3 |
| 27 | + - 36 -> 12 |
| 28 | + - 24 -> 24 |
| 29 | + - number of variables: 36 |
| 30 | + |
| 31 | + - 0: Albumin (g/dL) |
| 32 | + - 1: ALP [Alkaline phosphatase (IU/L)] |
| 33 | + - 2: ALT [Alanine transaminase (IU/L)] |
| 34 | + - 3: AST [Aspartate transaminase (IU/L)] |
| 35 | + - 4: Bilirubin (mg/dL) |
| 36 | + - 5: BUN [Blood urea nitrogen (mg/dL)] |
| 37 | + - 6: Cholesterol (mg/dL) |
| 38 | + - 7: Creatinine [Serum creatinine (mg/dL)] |
| 39 | + - 8: DiasABP [Invasive diastolic arterial blood pressure (mmHg)] |
| 40 | + - 9: FiO2 [Fractional inspired O2 (0-1)] |
| 41 | + - 10: GCS [Glasgow Coma Score (3-15)] |
| 42 | + - 11: Glucose [Serum glucose (mg/dL)] |
| 43 | + - 12: HCO3 [Serum bicarbonate (mmol/L)] |
| 44 | + - 13: HCT [Hematocrit (%)] |
| 45 | + - 14: HR [Heart rate (bpm)] |
| 46 | + - 15: K [Serum potassium (mEq/L)] |
| 47 | + - 16: Lactate (mmol/L) |
| 48 | + - 17: Mg [Serum magnesium (mmol/L)] |
| 49 | + - 18: MAP [Invasive mean arterial blood pressure (mmHg)] |
| 50 | + - 19: MechVent [Mechanical ventilation respiration (0:false, or 1:true)] |
| 51 | + - 20: Na [Serum sodium (mEq/L)] |
| 52 | + - 21: NIDiasABP [Non-invasive diastolic arterial blood pressure (mmHg)] |
| 53 | + - 22: NIMAP [Non-invasive mean arterial blood pressure (mmHg)] |
| 54 | + - 23: NISysABP [Non-invasive systolic arterial blood pressure (mmHg)] |
| 55 | + - 24: PaCO2 [partial pressure of arterial CO2 (mmHg)] |
| 56 | + - 25: PaO2 [Partial pressure of arterial O2 (mmHg)] |
| 57 | + - 26: pH [Arterial pH (0-14)] |
| 58 | + - 27: Platelets (cells/nL) |
| 59 | + - 28: RespRate [Respiration rate (bpm)] |
| 60 | + - 29: SaO2 [O2 saturation in hemoglobin (%)] |
| 61 | + - 30: SysABP [Invasive systolic arterial blood pressure (mmHg)] |
| 62 | + - 31: Temp [Temperature (°C)] |
| 63 | + - 32: TropI [Troponin-I (μg/L)] |
| 64 | + - 33: TropT [Troponin-T (μg/L)] |
| 65 | + - 34: Urine [Urine output (mL)] |
| 66 | + - 35: WBC [White blood cell count (cells/nL)] |
| 67 | + - number of samples: 11981 (9704 + 1078 + 1199) |
| 68 | + ''' |
18 | 69 | def __init__( |
19 | 70 | self, |
20 | 71 | configs: ExpConfigs, |
21 | 72 | flag: str = 'train', |
22 | 73 | **kwargs |
23 | 74 | ): |
24 | | - ''' |
25 | | - wrapper for Physionet 2012 dataset implemented in tsdm |
26 | | - tsdm: https://openreview.net/forum?id=a-bD9-0ycs0 |
27 | | -
|
28 | | - this version of P12 does not align the timesteps among samples (but do align within sample), which means: |
29 | | - - It use custom collate_fn to pad trailing 0s in each batch |
30 | | - - Tensor length along time dimension is not fixed in different batches, which depends on the max number of timesteps in each batch |
31 | | - - time steps does not spread evenly, and the start and end time is also not fixed |
32 | | -
|
33 | | - - max time length: 48 |
34 | | - - number of variables: 36 |
35 | | - |
36 | | - - 0: Albumin (g/dL) |
37 | | - - 1: ALP [Alkaline phosphatase (IU/L)] |
38 | | - - 2: ALT [Alanine transaminase (IU/L)] |
39 | | - - 3: AST [Aspartate transaminase (IU/L)] |
40 | | - - 4: Bilirubin (mg/dL) |
41 | | - - 5: BUN [Blood urea nitrogen (mg/dL)] |
42 | | - - 6: Cholesterol (mg/dL) |
43 | | - - 7: Creatinine [Serum creatinine (mg/dL)] |
44 | | - - 8: DiasABP [Invasive diastolic arterial blood pressure (mmHg)] |
45 | | - - 9: FiO2 [Fractional inspired O2 (0-1)] |
46 | | - - 10: GCS [Glasgow Coma Score (3-15)] |
47 | | - - 11: Glucose [Serum glucose (mg/dL)] |
48 | | - - 12: HCO3 [Serum bicarbonate (mmol/L)] |
49 | | - - 13: HCT [Hematocrit (%)] |
50 | | - - 14: HR [Heart rate (bpm)] |
51 | | - - 15: K [Serum potassium (mEq/L)] |
52 | | - - 16: Lactate (mmol/L) |
53 | | - - 17: Mg [Serum magnesium (mmol/L)] |
54 | | - - 18: MAP [Invasive mean arterial blood pressure (mmHg)] |
55 | | - - 19: MechVent [Mechanical ventilation respiration (0:false, or 1:true)] |
56 | | - - 20: Na [Serum sodium (mEq/L)] |
57 | | - - 21: NIDiasABP [Non-invasive diastolic arterial blood pressure (mmHg)] |
58 | | - - 22: NIMAP [Non-invasive mean arterial blood pressure (mmHg)] |
59 | | - - 23: NISysABP [Non-invasive systolic arterial blood pressure (mmHg)] |
60 | | - - 24: PaCO2 [partial pressure of arterial CO2 (mmHg)] |
61 | | - - 25: PaO2 [Partial pressure of arterial O2 (mmHg)] |
62 | | - - 26: pH [Arterial pH (0-14)] |
63 | | - - 27: Platelets (cells/nL) |
64 | | - - 28: RespRate [Respiration rate (bpm)] |
65 | | - - 29: SaO2 [O2 saturation in hemoglobin (%)] |
66 | | - - 30: SysABP [Invasive systolic arterial blood pressure (mmHg)] |
67 | | - - 31: Temp [Temperature (°C)] |
68 | | - - 32: TropI [Troponin-I (μg/L)] |
69 | | - - 33: TropT [Troponin-T (μg/L)] |
70 | | - - 34: Urine [Urine output (mL)] |
71 | | - - 35: WBC [White blood cell count (cells/nL)] |
72 | | - - number of samples: 11981 |
73 | | - ''' |
74 | | - logger.debug(f"getting {flag} set of PhysioNet'12 in tsdm format") |
75 | 75 | self.configs = configs |
76 | 76 | assert flag in ['train', 'test', 'val', 'test_all'] |
77 | 77 | self.flag = flag |
|
0 commit comments