Update Mimic4Dataset.py
Browse files- Mimic4Dataset.py +11 -13
Mimic4Dataset.py
CHANGED
@@ -236,7 +236,6 @@ class Mimic4DatasetConfig(datasets.BuilderConfig):
|
|
236 |
**kwargs,
|
237 |
):
|
238 |
print("init config")
|
239 |
-
self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out,self.path = self.create_cohort()
|
240 |
super().__init__(**kwargs)
|
241 |
|
242 |
class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
@@ -248,21 +247,13 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
248 |
self.config_path = kwargs.pop("config_path",None)
|
249 |
self.test_size = kwargs.pop("test_size",0.2)
|
250 |
self.val_size = kwargs.pop("val_size",0.1)
|
|
|
|
|
|
|
251 |
super().__init__(**kwargs)
|
252 |
print("init dataset")
|
253 |
|
254 |
|
255 |
-
if self.encoding:
|
256 |
-
print("init encod")
|
257 |
-
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)
|
258 |
-
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)
|
259 |
-
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)
|
260 |
-
|
261 |
-
X_train_encoded.to_csv(self.path+"/X_train_encoded.csv", index=False)
|
262 |
-
X_test_encoded.to_csv(self.path+"/X_test_encoded.csv", index=False)
|
263 |
-
X_val_encoded.to_csv(self.path+"/X_val_encoded.csv", index=False)
|
264 |
-
|
265 |
-
|
266 |
|
267 |
BUILDER_CONFIGS = [
|
268 |
Mimic4DatasetConfig(
|
@@ -597,7 +588,14 @@ class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
597 |
|
598 |
def _info_encoded(self):
|
599 |
print("init info encod")
|
600 |
-
X_train_encoded
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
columns = {col: self.map_dtype(X_train_encoded[col].dtype) for col in X_train_encoded.columns}
|
602 |
features = datasets.Features(columns)
|
603 |
return datasets.DatasetInfo(
|
|
|
236 |
**kwargs,
|
237 |
):
|
238 |
print("init config")
|
|
|
239 |
super().__init__(**kwargs)
|
240 |
|
241 |
class Mimic4Dataset(datasets.GeneratorBasedBuilder):
|
|
|
247 |
self.config_path = kwargs.pop("config_path",None)
|
248 |
self.test_size = kwargs.pop("test_size",0.2)
|
249 |
self.val_size = kwargs.pop("val_size",0.1)
|
250 |
+
|
251 |
+
self.feat_cond, self.feat_chart, self.feat_proc, self.feat_meds, self.feat_out,self.path = self.create_cohort()
|
252 |
+
|
253 |
super().__init__(**kwargs)
|
254 |
print("init dataset")
|
255 |
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
BUILDER_CONFIGS = [
|
259 |
Mimic4DatasetConfig(
|
|
|
588 |
|
589 |
def _info_encoded(self):
|
590 |
print("init info encod")
|
591 |
+
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)
|
592 |
+
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)
|
593 |
+
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)
|
594 |
+
|
595 |
+
X_train_encoded.to_csv(self.path+"/X_train_encoded.csv", index=False)
|
596 |
+
X_test_encoded.to_csv(self.path+"/X_test_encoded.csv", index=False)
|
597 |
+
X_val_encoded.to_csv(self.path+"/X_val_encoded.csv", index=False)
|
598 |
+
|
599 |
columns = {col: self.map_dtype(X_train_encoded[col].dtype) for col in X_train_encoded.columns}
|
600 |
features = datasets.Features(columns)
|
601 |
return datasets.DatasetInfo(
|