Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +4 -4
Mimic4Dataset.py
CHANGED
@@ -462,12 +462,11 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
462 |
ins_encoder.fit(insVocab)
|
463 |
with open(filepath, 'rb') as fp:
|
464 |
dico = pickle.load(fp)
|
465 |
-
outDict,chartDict,condDict,procDict,medDict = self.open_dict(self.feat_cond,self.feat_proc,self.feat_out, self.feat_chart, self.feat_lab, self.feat_meds)
|
466 |
df = pd.DataFrame.from_dict(dico, orient='index')
|
467 |
|
468 |
for i, data in df.iterrows():
|
469 |
concat_cols=[]
|
470 |
-
dyn_df,cond_df,demo=concat_data(data,self.config.name.replace(" ","_"),self.feat_cond,self.feat_proc,self.feat_out, self.feat_chart, self.feat_meds,self.feat_lab,outDict,chartDict,condDict,procDict,medDict)
|
471 |
dyn=dyn_df.copy()
|
472 |
dyn.columns=dyn.columns.droplevel(0)
|
473 |
cols=dyn.columns
|
@@ -518,9 +517,8 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
518 |
def _generate_examples_deep(self, filepath):
|
519 |
with open(filepath, 'rb') as fp:
|
520 |
dico = pickle.load(fp)
|
521 |
-
outDict,chartDict,condDict,procDict,medDict = self.open_dict(self.feat_cond,self.feat_proc,self.feat_out, self.feat_chart, self.feat_lab, self.feat_meds)
|
522 |
for key, data in dico.items():
|
523 |
-
stat, demo, meds, chart, out, proc, lab, y = generate_deep(data, self.config.name.replace(" ","_"), self.feat_cond, self.feat_proc, self.feat_out, self.feat_chart, self.feat_meds,self.feat_lab,outDict,chartDict,condDict,procDict,medDict)
|
524 |
|
525 |
if self.verif_dim_tensor(proc, out, chart, meds, lab):
|
526 |
if self.data_icu:
|
@@ -605,6 +603,8 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
605 |
def _info(self):
|
606 |
self.path = self.init_cohort()
|
607 |
self.size_cond, self.size_proc, self.size_meds, self.size_out, self.size_chart, self.size_lab, eth_vocab,gender_vocab,age_vocab,ins_vocab=vocab(self.config.name.replace(" ","_"),self.feat_cond,self.feat_proc,self.feat_out,self.feat_chart,self.feat_meds,self.feat_lab)
|
|
|
|
|
608 |
if (self.encoding == 'concat' or self.encoding =='aggreg'):
|
609 |
return self._info_encoded()
|
610 |
|
|
|
462 |
ins_encoder.fit(insVocab)
|
463 |
with open(filepath, 'rb') as fp:
|
464 |
dico = pickle.load(fp)
|
|
|
465 |
df = pd.DataFrame.from_dict(dico, orient='index')
|
466 |
|
467 |
for i, data in df.iterrows():
|
468 |
concat_cols=[]
|
469 |
+
dyn_df,cond_df,demo=concat_data(data,self.config.name.replace(" ","_"),self.feat_cond,self.feat_proc,self.feat_out, self.feat_chart, self.feat_meds,self.feat_lab,self.outDict,self.chartDict,self.condDict,self.procDict,self.medDict)
|
470 |
dyn=dyn_df.copy()
|
471 |
dyn.columns=dyn.columns.droplevel(0)
|
472 |
cols=dyn.columns
|
|
|
517 |
def _generate_examples_deep(self, filepath):
|
518 |
with open(filepath, 'rb') as fp:
|
519 |
dico = pickle.load(fp)
|
|
|
520 |
for key, data in dico.items():
|
521 |
+
stat, demo, meds, chart, out, proc, lab, y = generate_deep(data, self.config.name.replace(" ","_"), self.feat_cond, self.feat_proc, self.feat_out, self.feat_chart, self.feat_meds,self.feat_lab,self.outDict,self.chartDict,self.condDict,self.procDict,self.medDict)
|
522 |
|
523 |
if self.verif_dim_tensor(proc, out, chart, meds, lab):
|
524 |
if self.data_icu:
|
|
|
603 |
def _info(self):
|
604 |
self.path = self.init_cohort()
|
605 |
self.size_cond, self.size_proc, self.size_meds, self.size_out, self.size_chart, self.size_lab, eth_vocab,gender_vocab,age_vocab,ins_vocab=vocab(self.config.name.replace(" ","_"),self.feat_cond,self.feat_proc,self.feat_out,self.feat_chart,self.feat_meds,self.feat_lab)
|
606 |
+
self.outDict,self.chartDict,self.condDict,self.procDict,self.medDict = self.open_dict(self.feat_cond,self.feat_proc,self.feat_out, self.feat_chart, self.feat_lab, self.feat_meds)
|
607 |
+
|
608 |
if (self.encoding == 'concat' or self.encoding =='aggreg'):
|
609 |
return self._info_encoded()
|
610 |
|