Update task_cohort.py
Browse files- task_cohort.py +7 -7
task_cohort.py
CHANGED
|
@@ -4,9 +4,6 @@ import yaml
|
|
| 4 |
import time
|
| 5 |
import yaml
|
| 6 |
import sys
|
| 7 |
-
from .day_intervals_cohort_v22 import extract_data
|
| 8 |
-
from .data_generation_icu_modify import Generator_icu
|
| 9 |
-
from .data_generation_modify import Generator
|
| 10 |
|
| 11 |
def check_config_file(task,config_file):
|
| 12 |
with open(config_file) as f:
|
|
@@ -135,6 +132,9 @@ def create_cohort(task, mimic_path, config_path):
|
|
| 135 |
import day_intervals_cohort
|
| 136 |
import feature_selection_icu
|
| 137 |
import feature_selection_hosp
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
|
| 140 |
root_dir = os.path.dirname(os.path.abspath('UserInterface.ipynb'))
|
|
@@ -199,7 +199,7 @@ def create_cohort(task, mimic_path, config_path):
|
|
| 199 |
|
| 200 |
#-----------------------------------------------EXTRACT MIMIC-----------------------------------------------------
|
| 201 |
if version == '2':
|
| 202 |
-
cohort_output = extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
| 203 |
|
| 204 |
elif version == '1':
|
| 205 |
cohort_output = day_intervals_cohort.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
|
@@ -275,7 +275,7 @@ def create_cohort(task, mimic_path, config_path):
|
|
| 275 |
thresh=config['outlier']
|
| 276 |
left_thresh=config['left_outlier']
|
| 277 |
feature_selection_hosp.preprocess_features_hosp(cohort_output, False,False, False,lab_flag,False,False,False,clean_chart,impute_outlier_chart,thresh,left_thresh)
|
| 278 |
-
# ---------------------------------------
|
| 279 |
if radimp == 'forward fill and mean' :
|
| 280 |
impute='Mean'
|
| 281 |
elif radimp =='forward fill and median':
|
|
@@ -284,9 +284,9 @@ def create_cohort(task, mimic_path, config_path):
|
|
| 284 |
impute = False
|
| 285 |
|
| 286 |
if data_icu:
|
| 287 |
-
gen=
|
| 288 |
else:
|
| 289 |
-
gen=Generator(cohort_output,data_mort,data_admn,data_los,diag_flag,lab_flag,proc_flag,med_flag,impute,include,bucket,predW)
|
| 290 |
|
| 291 |
end = time.time()
|
| 292 |
print("Time elapsed : ", round((end - start)/60,2),"mins")
|
|
|
|
| 4 |
import time
|
| 5 |
import yaml
|
| 6 |
import sys
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
def check_config_file(task,config_file):
|
| 9 |
with open(config_file) as f:
|
|
|
|
| 132 |
import day_intervals_cohort
|
| 133 |
import feature_selection_icu
|
| 134 |
import feature_selection_hosp
|
| 135 |
+
import day_instervals_cohort_v22
|
| 136 |
+
import data_generation_icu_modify
|
| 137 |
+
import data_generation_modify
|
| 138 |
|
| 139 |
|
| 140 |
root_dir = os.path.dirname(os.path.abspath('UserInterface.ipynb'))
|
|
|
|
| 199 |
|
| 200 |
#-----------------------------------------------EXTRACT MIMIC-----------------------------------------------------
|
| 201 |
if version == '2':
|
| 202 |
+
cohort_output = day_instervals_cohort_v22.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
| 203 |
|
| 204 |
elif version == '1':
|
| 205 |
cohort_output = day_intervals_cohort.extract_data(icu_no_icu,label,tim,icd_code, root_dir,version_path,disease_label)
|
|
|
|
| 275 |
thresh=config['outlier']
|
| 276 |
left_thresh=config['left_outlier']
|
| 277 |
feature_selection_hosp.preprocess_features_hosp(cohort_output, False,False, False,lab_flag,False,False,False,clean_chart,impute_outlier_chart,thresh,left_thresh)
|
| 278 |
+
# ---------------------------------------time-Series Representation--------------------------------------------
|
| 279 |
if radimp == 'forward fill and mean' :
|
| 280 |
impute='Mean'
|
| 281 |
elif radimp =='forward fill and median':
|
|
|
|
| 284 |
impute = False
|
| 285 |
|
| 286 |
if data_icu:
|
| 287 |
+
gen=data_generation_icu_modify.Generator_icu(task,cohort_output,data_mort,data_admn,data_los,diag_flag,proc_flag,out_flag,chart_flag,med_flag,impute,include,bucket,predW)
|
| 288 |
else:
|
| 289 |
+
gen=data_generation_modify.Generator(cohort_output,data_mort,data_admn,data_los,diag_flag,lab_flag,proc_flag,med_flag,impute,include,bucket,predW)
|
| 290 |
|
| 291 |
end = time.time()
|
| 292 |
print("Time elapsed : ", round((end - start)/60,2),"mins")
|