Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +7 -4
Mimic4Dataset.py
CHANGED
@@ -45,7 +45,10 @@ def check_config(task,config_file):
|
|
45 |
with open(config_file) as f:
|
46 |
config = yaml.safe_load(f)
|
47 |
|
48 |
-
|
|
|
|
|
|
|
49 |
time = config['timePrediction']
|
50 |
label = task
|
51 |
timeW = config['timeWindow']
|
@@ -99,18 +102,18 @@ def check_config(task,config_file):
|
|
99 |
|
100 |
elif task=='Mortality':
|
101 |
time=0
|
102 |
-
|
103 |
assert (predW<=8 and predW>=2, "Prediction window should be between 2 and 8")
|
104 |
assert (timeW[0]=='Fisrt' and include<=72 and include>=24, "Time window should be between First 24 and First 72")
|
105 |
|
106 |
elif task=='Length of Stay':
|
107 |
-
|
108 |
assert (timeW[0]=='Fisrt' and include<=72 and include>=24, "Time window should be between Fisrt 24 and Fisrt 72")
|
109 |
assert (time<=10 and time>=1, "Length of stay should be between 1 and 10")
|
110 |
predW=0
|
111 |
|
112 |
elif task=='Readmission':
|
113 |
-
|
114 |
assert (timeW[0]=='Last' and include<=72 and include>=24, "Time window should be between Last 24 and Last 72")
|
115 |
assert (time<=150 and time>=10 and time%10==0, "Readmission window should be between 10 and 150 with a step of 10")
|
116 |
predW=0
|
|
|
45 |
with open(config_file) as f:
|
46 |
config = yaml.safe_load(f)
|
47 |
|
48 |
+
if task=='Phenotype':
|
49 |
+
disease_label = config['disease_label']
|
50 |
+
else :
|
51 |
+
disease_label = ""
|
52 |
time = config['timePrediction']
|
53 |
label = task
|
54 |
timeW = config['timeWindow']
|
|
|
102 |
|
103 |
elif task=='Mortality':
|
104 |
time=0
|
105 |
+
label= 'Mortality'
|
106 |
assert (predW<=8 and predW>=2, "Prediction window should be between 2 and 8")
|
107 |
assert (timeW[0]=='Fisrt' and include<=72 and include>=24, "Time window should be between First 24 and First 72")
|
108 |
|
109 |
elif task=='Length of Stay':
|
110 |
+
label= 'Length of Stay'
|
111 |
assert (timeW[0]=='Fisrt' and include<=72 and include>=24, "Time window should be between Fisrt 24 and Fisrt 72")
|
112 |
assert (time<=10 and time>=1, "Length of stay should be between 1 and 10")
|
113 |
predW=0
|
114 |
|
115 |
elif task=='Readmission':
|
116 |
+
label= 'Readmission'
|
117 |
assert (timeW[0]=='Last' and include<=72 and include>=24, "Time window should be between Last 24 and Last 72")
|
118 |
assert (time<=150 and time>=10 and time%10==0, "Readmission window should be between 10 and 150 with a step of 10")
|
119 |
predW=0
|