thbndi commited on
Commit
1f55b95
1 Parent(s): a456741

Update Mimic4Dataset.py

Browse files
Files changed (1) hide show
  1. Mimic4Dataset.py +20 -13
Mimic4Dataset.py CHANGED
@@ -83,18 +83,14 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
83
  },
84
  "CHART": datasets.Sequence(
85
  {
86
- "signal" : datasets.Sequence(
87
- {
88
- "id": datasets.Value("int32"),
89
- "value": datasets.Sequence(datasets.Sequence(datasets.Value("float32")))
90
- }
91
- ),
92
- "val" : datasets.Sequence(
93
- {
94
- "id": datasets.Value("int32"),
95
- "value": datasets.Sequence(datasets.Value("float32"))
96
- }
97
- ),
98
  }),
99
  "OUT": {
100
  "id": datasets.Sequence(datasets.Value("int32")),
@@ -142,13 +138,24 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
142
  outs = {"id" : items_outs,
143
  "value": values_outs}
144
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  yield int(hid), {
147
  "gender" : gender,
148
  "ethnicity" : eth,
149
  "age" : age,
150
  "PROC" : procs,
151
- "CHART" : None,
 
152
  "OUT" : outs,
153
  "COND" : cond_features,
154
  "label" : label
 
83
  },
84
  "CHART": datasets.Sequence(
85
  {
86
+ "signal" : {
87
+ "id": datasets.Sequence(datasets.Value("int32")),
88
+ "value": datasets.Sequence(datasets.Sequence(datasets.Value("float32")))
89
+ },
90
+ "val" : {
91
+ "id": datasets.Sequence(datasets.Value("int32")),
92
+ "value": datasets.Sequence(datasets.Sequence(datasets.Value("float32")))
93
+ },
 
 
 
 
94
  }),
95
  "OUT": {
96
  "id": datasets.Sequence(datasets.Value("int32")),
 
138
  outs = {"id" : items_outs,
139
  "value": values_outs}
140
 
141
+ #chart signal
142
+ items_chart_sig = list(chart_features['signal'].keys())
143
+ values_chart_sig =[chart_features['signal'][i] for i in items_chart_sig ]
144
+ chart_sig = {"id" : items_chart_sig,
145
+ "value": values_chart_sig}
146
+ #chart val
147
+ items_chart_val = list(chart_features['val'].keys())
148
+ values_chart_val =[chart_features['val'][i] for i in items_chart_val ]
149
+ chart_val = {"id" : items_chart_val,
150
+ "value": values_chart_val}
151
 
152
  yield int(hid), {
153
  "gender" : gender,
154
  "ethnicity" : eth,
155
  "age" : age,
156
  "PROC" : procs,
157
+ "CHART" : {"signal" : chart_sig,
158
+ "val" : chart_val},
159
  "OUT" : outs,
160
  "COND" : cond_features,
161
  "label" : label