Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +10 -10
Mimic4Dataset.py
CHANGED
@@ -246,11 +246,17 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
246 |
self.config_path = kwargs.pop("config_path",None)
|
247 |
self.test_size = kwargs.pop("test_size",0.2)
|
248 |
self.val_size = kwargs.pop("val_size",0.1)
|
249 |
-
|
250 |
-
|
251 |
super().__init__(**kwargs)
|
252 |
-
self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out,self.path = self.create_cohort()
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
BUILDER_CONFIGS = [
|
256 |
Mimic4DatasetConfig(
|
@@ -583,13 +589,7 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
583 |
###########################################################ENCODED##################################################################
|
584 |
|
585 |
def _info_encoded(self):
|
586 |
-
X_train_encoded=
|
587 |
-
X_test_encoded=generate_split(self.path+'/test_data.pkl',self.config.name,True,self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out)
|
588 |
-
X_val_encoded=generate_split(self.path+'/val_data.pkl',self.config.name,True,self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out)
|
589 |
-
X_train_encoded.to_csv(self.path+"/X_train_encoded.csv", index=False)
|
590 |
-
X_test_encoded.to_csv(self.path+"/X_test_encoded.csv", index=False)
|
591 |
-
X_val_encoded.to_csv(self.path+"/X_val_encoded.csv", index=False)
|
592 |
-
|
593 |
columns = {col: self.map_dtype(X_train_encoded[col].dtype) for col in X_train_encoded.columns}
|
594 |
features = datasets.Features(columns)
|
595 |
return datasets.DatasetInfo(
|
|
|
246 |
self.config_path = kwargs.pop("config_path",None)
|
247 |
self.test_size = kwargs.pop("test_size",0.2)
|
248 |
self.val_size = kwargs.pop("val_size",0.1)
|
|
|
|
|
249 |
super().__init__(**kwargs)
|
|
|
250 |
|
251 |
+
self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out,self.path = self.create_cohort()
|
252 |
+
if self.encoding:
|
253 |
+
X_train_encoded=generate_split(self.path+'/train_data.pkl',self.config.name,True,self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out)
|
254 |
+
X_test_encoded=generate_split(self.path+'/test_data.pkl',self.config.name,True,self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out)
|
255 |
+
X_val_encoded=generate_split(self.path+'/val_data.pkl',self.config.name,True,self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out)
|
256 |
+
|
257 |
+
X_train_encoded.to_csv(self.path+"/X_train_encoded.csv", index=False)
|
258 |
+
X_test_encoded.to_csv(self.path+"/X_test_encoded.csv", index=False)
|
259 |
+
X_val_encoded.to_csv(self.path+"/X_val_encoded.csv", index=False)
|
260 |
|
261 |
BUILDER_CONFIGS = [
|
262 |
Mimic4DatasetConfig(
|
|
|
589 |
###########################################################ENCODED##################################################################
|
590 |
|
591 |
def _info_encoded(self):
|
592 |
+
X_train_encoded = pd.read_csv(self.path+'/X_train_encoded.csv', header=0)
|
|
|
|
|
|
|
|
|
|
|
|
|
593 |
columns = {col: self.map_dtype(X_train_encoded[col].dtype) for col in X_train_encoded.columns}
|
594 |
features = datasets.Features(columns)
|
595 |
return datasets.DatasetInfo(
|