thbndi commited on
Commit
7ef7d27
·
1 Parent(s): ce8656a

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +8 -8
Mimic4Dataset.py CHANGED
@@ -358,6 +358,8 @@ def getXY_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds):
358
  charts = charts.unsqueeze(0)
359
  charts = torch.tensor(charts)
360
  charts = charts.type(torch.LongTensor)
 
 
361
  if feat_meds:
362
  meds = dyn['MEDS']
363
  meds=meds.to_numpy()
@@ -365,6 +367,7 @@ def getXY_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds):
365
  meds = meds.unsqueeze(0)
366
  meds = torch.tensor(meds)
367
  meds = meds.type(torch.LongTensor)
 
368
 
369
  if feat_proc:
370
  proc = dyn['PROC']
@@ -373,6 +376,7 @@ def getXY_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds):
373
  proc = proc.unsqueeze(0)
374
  proc = torch.tensor(proc)
375
  proc = proc.type(torch.LongTensor)
 
376
 
377
  if feat_out:
378
  out = dyn['OUT']
@@ -381,6 +385,7 @@ def getXY_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds):
381
  out = out.unsqueeze(0)
382
  out = torch.tensor(out)
383
  out = out.type(torch.LongTensor)
 
384
 
385
  if feat_lab:
386
  lab = dyn['LAB']
@@ -389,6 +394,7 @@ def getXY_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds):
389
  lab = lab.unsqueeze(0)
390
  lab = torch.tensor(lab)
391
  lab = lab.type(torch.LongTensor)
 
392
 
393
  ####################""
394
 
@@ -954,15 +960,9 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
954
  with open(filepath, 'rb') as fp:
955
  dico = pickle.load(fp)
956
  task=self.config.name.replace(" ","_")
957
- i=0
958
- for key, data in dico.items():
959
-
960
  stat, demo, meds, chart, out, proc, lab, y = getXY_deep(data, task, self.feat_cond, self.feat_proc, self.feat_out, self.feat_chart, self.feat_meds)
961
- if i==998:
962
- print('998 : \n', stat.shape, demo.shape, meds.shape, chart.shape, out.shape, proc.shape, lab.shape, y.shape)
963
- if i==999:
964
- print('\n 999 : \n', stat.shape, demo.shape, meds.shape, chart.shape, out.shape, proc.shape, lab.shape, y.shape)
965
- i+=1
966
  yield int(key), {
967
  'label': y,
968
  'DEMO': demo,
 
358
  charts = charts.unsqueeze(0)
359
  charts = torch.tensor(charts)
360
  charts = charts.type(torch.LongTensor)
361
+ chart=chart.view(chart.shape[1],chart.shape[2])
362
+
363
  if feat_meds:
364
  meds = dyn['MEDS']
365
  meds=meds.to_numpy()
 
367
  meds = meds.unsqueeze(0)
368
  meds = torch.tensor(meds)
369
  meds = meds.type(torch.LongTensor)
370
+ meds=meds.view(meds.shape[1],meds.shape[2])
371
 
372
  if feat_proc:
373
  proc = dyn['PROC']
 
376
  proc = proc.unsqueeze(0)
377
  proc = torch.tensor(proc)
378
  proc = proc.type(torch.LongTensor)
379
+ proc=proc.view(proc.shape[1],proc.shape[2])
380
 
381
  if feat_out:
382
  out = dyn['OUT']
 
385
  out = out.unsqueeze(0)
386
  out = torch.tensor(out)
387
  out = out.type(torch.LongTensor)
388
+ out=out.view(out.shape[1],out.shape[2])
389
 
390
  if feat_lab:
391
  lab = dyn['LAB']
 
394
  lab = lab.unsqueeze(0)
395
  lab = torch.tensor(lab)
396
  lab = lab.type(torch.LongTensor)
397
+ lab=lab.view(lab.shape[1],lab.shape[2])
398
 
399
  ####################""
400
 
 
960
  with open(filepath, 'rb') as fp:
961
  dico = pickle.load(fp)
962
  task=self.config.name.replace(" ","_")
963
+ for key, data in dico.items():
 
 
964
  stat, demo, meds, chart, out, proc, lab, y = getXY_deep(data, task, self.feat_cond, self.feat_proc, self.feat_out, self.feat_chart, self.feat_meds)
965
+
 
 
 
 
966
  yield int(key), {
967
  'label': y,
968
  'DEMO': demo,