thbndi commited on
Commit
2e8d614
·
1 Parent(s): 33a9b6a

Update dataset_utils.py

Browse files
Files changed (1) hide show
  1. dataset_utils.py +17 -13
dataset_utils.py CHANGED
@@ -279,16 +279,25 @@ def generate_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds,fe
279
  lab=lab.to_numpy()
280
  lab = torch.tensor(lab, dtype=torch.long)
281
  lab = lab.tolist()
282
-
283
- stat=cond_df
284
- stat = stat.to_numpy()
285
- stat = torch.tensor(stat)
286
- if stat_df[0].nelement():
287
- stat_df = torch.cat((stat_df,stat),0)
288
- else:
289
- stat_df = stat
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  y = int(demo['label'])
 
 
 
292
  demo["gender"].replace(gender_vocab, inplace=True)
293
  demo["ethnicity"].replace(eth_vocab, inplace=True)
294
  demo["insurance"].replace(ins_vocab, inplace=True)
@@ -300,14 +309,9 @@ def generate_deep(data,task,feat_cond,feat_proc,feat_out,feat_chart,feat_meds,fe
300
  demo_df = torch.cat((demo_df,demo),0)
301
  else:
302
  demo_df = demo
303
- stat_df = torch.tensor(stat_df)
304
- stat_df = stat_df.type(torch.LongTensor)
305
- stat_df = stat_df.squeeze()
306
  demo_df = torch.tensor(demo_df)
307
  demo_df = demo_df.type(torch.LongTensor)
308
  demo_df=demo_df.squeeze()
309
- y_df = torch.tensor(y)
310
- y_df = y_df.type(torch.LongTensor)
311
 
312
  return stat_df, demo_df, meds, charts, out, proc, lab, y
313
 
 
279
  lab=lab.to_numpy()
280
  lab = torch.tensor(lab, dtype=torch.long)
281
  lab = lab.tolist()
 
 
 
 
 
 
 
 
282
 
283
+ if feat_cond:
284
+ stat=cond_df
285
+ stat = stat.to_numpy()
286
+ stat = torch.tensor(stat)
287
+ if stat_df[0].nelement():
288
+ stat_df = torch.cat((stat_df,stat),0)
289
+ else:
290
+ stat_df = stat
291
+
292
+ stat_df = torch.tensor(stat_df)
293
+ stat_df = stat_df.type(torch.LongTensor)
294
+ stat_df = stat_df.squeeze()
295
+
296
+
297
  y = int(demo['label'])
298
+ y_df = torch.tensor(y)
299
+ y_df = y_df.type(torch.LongTensor)
300
+
301
  demo["gender"].replace(gender_vocab, inplace=True)
302
  demo["ethnicity"].replace(eth_vocab, inplace=True)
303
  demo["insurance"].replace(ins_vocab, inplace=True)
 
309
  demo_df = torch.cat((demo_df,demo),0)
310
  else:
311
  demo_df = demo
 
 
 
312
  demo_df = torch.tensor(demo_df)
313
  demo_df = demo_df.type(torch.LongTensor)
314
  demo_df=demo_df.squeeze()
 
 
315
 
316
  return stat_df, demo_df, meds, charts, out, proc, lab, y
317