Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +12 -2
Mimic4Dataset.py
CHANGED
@@ -61,6 +61,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
61 |
self.test_size = kwargs.pop("test_size",0.2)
|
62 |
self.val_size = kwargs.pop("val_size",0.1)
|
63 |
self.generate_cohort = kwargs.pop("generate_cohort",True)
|
|
|
64 |
|
65 |
if self.encoding == 'concat':
|
66 |
self.concat = True
|
@@ -524,10 +525,19 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
524 |
|
525 |
for key, data in dico.items():
|
526 |
cond_text,chart_text,meds_text,proc_text,out_text = generate_text(data,icd,items, self.feat_cond, self.feat_chart, self.feat_meds, self.feat_proc, self.feat_out)
|
527 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
528 |
yield int(key),{
|
529 |
'label' : data['label'],
|
530 |
-
'text':
|
531 |
}
|
532 |
|
533 |
#############################################################################################################################
|
|
|
61 |
self.test_size = kwargs.pop("test_size",0.2)
|
62 |
self.val_size = kwargs.pop("val_size",0.1)
|
63 |
self.generate_cohort = kwargs.pop("generate_cohort",True)
|
64 |
+
self.param = kwargs.pop("param",0)
|
65 |
|
66 |
if self.encoding == 'concat':
|
67 |
self.concat = True
|
|
|
525 |
|
526 |
for key, data in dico.items():
|
527 |
cond_text,chart_text,meds_text,proc_text,out_text = generate_text(data,icd,items, self.feat_cond, self.feat_chart, self.feat_meds, self.feat_proc, self.feat_out)
|
528 |
+
if self.param==1:
|
529 |
+
text= cond_text+chart_text+meds_text+proc_text+out_text
|
530 |
+
elif self.param==2:
|
531 |
+
text= cond_text
|
532 |
+
elif self.param==3:
|
533 |
+
text=cond_text+ chart_text
|
534 |
+
elif self.param==4:
|
535 |
+
text=cond_text+ chart_text+meds_text
|
536 |
+
elif self.param==5:
|
537 |
+
text=cond_text+ chart_text+meds_text+proc_text
|
538 |
yield int(key),{
|
539 |
'label' : data['label'],
|
540 |
+
'text': text
|
541 |
}
|
542 |
|
543 |
#############################################################################################################################
|