Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +14 -1
Mimic4Dataset.py
CHANGED
@@ -67,6 +67,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
67 |
self.test_size = kwargs.pop("test_size",0.2)
|
68 |
self.val_size = kwargs.pop("val_size",0.1)
|
69 |
self.generate_cohort = kwargs.pop("generate_cohort",True)
|
|
|
70 |
|
71 |
if self.encoding == 'concat':
|
72 |
self.concat = True
|
@@ -543,7 +544,19 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
543 |
|
544 |
for key, data in dico.items():
|
545 |
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)
|
546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
yield int(key),{
|
548 |
'label' : data['label'],
|
549 |
'text': text
|
|
|
67 |
self.test_size = kwargs.pop("test_size",0.2)
|
68 |
self.val_size = kwargs.pop("val_size",0.1)
|
69 |
self.generate_cohort = kwargs.pop("generate_cohort",True)
|
70 |
+
self.param = kwargs.pop("param",0)
|
71 |
|
72 |
if self.encoding == 'concat':
|
73 |
self.concat = True
|
|
|
544 |
|
545 |
for key, data in dico.items():
|
546 |
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)
|
547 |
+
for key, data in dico.items():
|
548 |
+
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)
|
549 |
+
if self.param==1:
|
550 |
+
text= cond_text+chart_text+meds_text+proc_text+out_text
|
551 |
+
elif self.param==2:
|
552 |
+
text= cond_text
|
553 |
+
elif self.param==3:
|
554 |
+
text=cond_text+ chart_text
|
555 |
+
elif self.param==4:
|
556 |
+
text=cond_text+ chart_text+meds_text
|
557 |
+
elif self.param==5:
|
558 |
+
text=cond_text+ chart_text+meds_text+proc_text
|
559 |
+
|
560 |
yield int(key),{
|
561 |
'label' : data['label'],
|
562 |
'text': text
|