forked from helenzeng0503/TransFed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupdata.py
More file actions
54 lines (44 loc) · 2.17 KB
/
setupdata.py
File metadata and controls
54 lines (44 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import numpy as np
import pandas as pd
# Set up data for Domain B limited labeled data
# Load datasets
datab_labeled = pd.read_csv("datab_labeled.csv")
shared_feats = [
'heartrate', 'respiration', 'noninvasivesystolic', 'noninvasivediastolic',
'noninvasivemean', 'admissionheight', 'dischargeweight','motor',
'verbal', 'gender_Unknown', 'ethnicity_Asian', 'gender_Other',
'ethnicity_Native American', 'ethnicity_African American', 'ethnicity_Hispanic',
'gender_Male', 'gender_Female','unitdischargestatus'
]
acols = [
'Hct', 'chloride', 'Hgb', 'RBC', 'admissionheight', 'dischargeweight',
'calcium', 'platelets x 1000', 'MCV', 'bicarbonate', 'RDW', 'AST (SGOT)',
'ALT (SGPT)', 'total protein', 'alkaline phos.', 'magnesium', '-basos',
'total bilirubin', '-polys', 'respiration', 'noninvasivesystolic',
'noninvasivediastolic', 'noninvasivemean', 'intubated', 'vent', 'dialysis',
'verbal', 'meds', 'urine', 'wbc', 'respiratoryrate', 'motor',
'ph', 'hematocrit', 'bun', 'bilirubin', 'creatinine', 'heartrate',
'albumin', 'sodium', 'ethnicity_African American',
'ethnicity_Asian', 'ethnicity_Caucasian', 'ethnicity_Hispanic',
'ethnicity_Native American', 'ethnicity_Other/Unknown', 'gender_Female',
'gender_Male', 'gender_Other', 'gender_Unknown'
]
bcols = [
'BUN', 'potassium', 'WBC x 1000', 'heartrate','respiration','noninvasivesystolic',
'glucose', 'meanbp', 'admissionheight', 'noninvasivediastolic', 'noninvasivemean',
'dischargeweight', 'anion gap', 'MCH', 'MCHC', '-lymphs', '-monos', '-eos',
'fio2', 'observationoffset', 'age','sao2', 'eyes', 'motor', 'pao2', 'pco2',
'ethnicity_African American','verbal',
'ethnicity_Asian', 'ethnicity_Caucasian', 'ethnicity_Hispanic',
'ethnicity_Native American', 'ethnicity_Other/Unknown', 'gender_Female',
'gender_Male', 'gender_Other', 'gender_Unknown'
]
# Extract anchors and labels directly from labeled dataset
anchors_labeled = datab_labeled[bcols].to_numpy()
anchors_labels_labeled = datab_labeled["unitdischargestatus"].to_numpy()
np.savez_compressed(
'5fold/fold1/anchors_labeled.npz',
anchors=anchors_labeled,
anchors_labels=anchors_labels_labeled
)
print("saved anchors_labeled.npz")