Update dataset_utils.py
Browse files- dataset_utils.py +8 -32
dataset_utils.py
CHANGED
|
@@ -246,59 +246,35 @@ def generate_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds,fe
|
|
| 246 |
stat = []
|
| 247 |
demo = []
|
| 248 |
|
| 249 |
-
|
| 250 |
size_cond, size_proc, size_meds, size_out, size_chart, size_lab, eth_vocab,gender_vocab,age_vocab,ins_vocab=vocab(task.replace(" ","_"),feat_cond,feat_proc,feat_out,feat_chart,feat_meds,False)
|
| 251 |
dyn,cond_df,demo=concat_data(data,task.replace(" ","_"),feat_cond,feat_proc,feat_out,feat_chart,feat_meds,feat_lab)
|
| 252 |
if feat_chart:
|
| 253 |
charts = dyn['CHART'].values
|
| 254 |
-
|
| 255 |
-
#charts = torch.tensor(charts, dtype=torch.long)
|
| 256 |
-
#charts = charts.tolist()
|
| 257 |
-
|
| 258 |
if feat_meds:
|
| 259 |
meds = dyn['MEDS'].values
|
| 260 |
|
| 261 |
if feat_proc:
|
| 262 |
-
proc = dyn['PROC']
|
| 263 |
|
| 264 |
if feat_out:
|
| 265 |
-
out = dyn['OUT']
|
| 266 |
|
| 267 |
if feat_lab:
|
| 268 |
-
lab = dyn['LAB']
|
| 269 |
|
| 270 |
if feat_cond:
|
| 271 |
stat=cond_df.values[0]
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
#stat = torch.tensor(stat)
|
| 275 |
-
#if stat_df[0].nelement():
|
| 276 |
-
# stat_df = torch.cat((stat_df,stat),0)
|
| 277 |
-
#else:
|
| 278 |
-
# stat_df = stat
|
| 279 |
-
|
| 280 |
-
#stat_df = torch.tensor(stat_df)
|
| 281 |
-
#stat_df = stat_df.type(torch.LongTensor)
|
| 282 |
-
#stat_df = stat_df.squeeze()
|
| 283 |
-
|
| 284 |
-
|
| 285 |
y = int(demo['label'])
|
| 286 |
|
| 287 |
demo["gender"].replace(gender_vocab, inplace=True)
|
| 288 |
demo["ethnicity"].replace(eth_vocab, inplace=True)
|
| 289 |
demo["insurance"].replace(ins_vocab, inplace=True)
|
| 290 |
demo["Age"].replace(age_vocab, inplace=True)
|
| 291 |
-
demo=demo[
|
| 292 |
-
demo = demo.values
|
| 293 |
-
|
| 294 |
-
#if demo_df[0].nelement():
|
| 295 |
-
# demo_df = torch.cat((demo_df,demo),0)
|
| 296 |
-
#else:
|
| 297 |
-
# demo_df = demo
|
| 298 |
-
#demo_df = torch.tensor(demo_df)
|
| 299 |
-
#demo_df = demo_df.type(torch.LongTensor)
|
| 300 |
-
#demo_df=demo_df.squeeze()
|
| 301 |
-
|
| 302 |
return stat, demo, meds, charts, out, proc, lab, y
|
| 303 |
|
| 304 |
|
|
|
|
| 246 |
stat = []
|
| 247 |
demo = []
|
| 248 |
|
|
|
|
| 249 |
size_cond, size_proc, size_meds, size_out, size_chart, size_lab, eth_vocab,gender_vocab,age_vocab,ins_vocab=vocab(task.replace(" ","_"),feat_cond,feat_proc,feat_out,feat_chart,feat_meds,False)
|
| 250 |
dyn,cond_df,demo=concat_data(data,task.replace(" ","_"),feat_cond,feat_proc,feat_out,feat_chart,feat_meds,feat_lab)
|
| 251 |
if feat_chart:
|
| 252 |
charts = dyn['CHART'].values
|
| 253 |
+
|
|
|
|
|
|
|
|
|
|
| 254 |
if feat_meds:
|
| 255 |
meds = dyn['MEDS'].values
|
| 256 |
|
| 257 |
if feat_proc:
|
| 258 |
+
proc = dyn['PROC'].values
|
| 259 |
|
| 260 |
if feat_out:
|
| 261 |
+
out = dyn['OUT'].values
|
| 262 |
|
| 263 |
if feat_lab:
|
| 264 |
+
lab = dyn['LAB'].values
|
| 265 |
|
| 266 |
if feat_cond:
|
| 267 |
stat=cond_df.values[0]
|
| 268 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
y = int(demo['label'])
|
| 270 |
|
| 271 |
demo["gender"].replace(gender_vocab, inplace=True)
|
| 272 |
demo["ethnicity"].replace(eth_vocab, inplace=True)
|
| 273 |
demo["insurance"].replace(ins_vocab, inplace=True)
|
| 274 |
demo["Age"].replace(age_vocab, inplace=True)
|
| 275 |
+
demo=demo["gender","ethnicity","insurance","Age"]
|
| 276 |
+
demo = demo.values
|
| 277 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
return stat, demo, meds, charts, out, proc, lab, y
|
| 279 |
|
| 280 |
|