Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +3 -11
Mimic4Dataset.py
CHANGED
@@ -67,7 +67,6 @@ 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 |
-
self.param = kwargs.pop("param",0)
|
71 |
|
72 |
if self.encoding == 'concat':
|
73 |
self.concat = True
|
@@ -407,6 +406,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
407 |
{
|
408 |
"label": datasets.ClassLabel(num_classes=2,names=["0", "1"]),
|
409 |
"features" : datasets.Sequence(datasets.Value("float32")),
|
|
|
410 |
}
|
411 |
)
|
412 |
return datasets.DatasetInfo(
|
@@ -470,6 +470,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
470 |
yield int(i), {
|
471 |
"label": label,
|
472 |
"features": X,
|
|
|
473 |
}
|
474 |
|
475 |
######################################################DEEP###############################################################
|
@@ -544,16 +545,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
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 |
-
|
548 |
-
text= cond_text+chart_text+meds_text+proc_text+out_text
|
549 |
-
elif self.param==2:
|
550 |
-
text= cond_text
|
551 |
-
elif self.param==3:
|
552 |
-
text=cond_text+ chart_text
|
553 |
-
elif self.param==4:
|
554 |
-
text=cond_text+ chart_text+meds_text
|
555 |
-
elif self.param==5:
|
556 |
-
text=cond_text+ chart_text+meds_text+proc_text
|
557 |
|
558 |
yield int(key),{
|
559 |
'label' : data['label'],
|
|
|
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
|
|
|
406 |
{
|
407 |
"label": datasets.ClassLabel(num_classes=2,names=["0", "1"]),
|
408 |
"features" : datasets.Sequence(datasets.Value("float32")),
|
409 |
+
"features_names" : datasets.Sequence(datasets.Value("string")),
|
410 |
}
|
411 |
)
|
412 |
return datasets.DatasetInfo(
|
|
|
470 |
yield int(i), {
|
471 |
"label": label,
|
472 |
"features": X,
|
473 |
+
"features_names" : feats
|
474 |
}
|
475 |
|
476 |
######################################################DEEP###############################################################
|
|
|
545 |
|
546 |
for key, data in dico.items():
|
547 |
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)
|
548 |
+
text= cond_text+chart_text+meds_text+proc_text+out_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
yield int(key),{
|
551 |
'label' : data['label'],
|