-
Notifications
You must be signed in to change notification settings - Fork 7
/
run.sh
executable file
·72 lines (48 loc) · 3.4 KB
/
run.sh
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
command=$1
if [ "$command" = "extract" ]; then
echo "EXTRACT DATA"
echo "Using client secret: $2"
echo "Using BigQuery project: $3"
echo
mkdir -p data
python ai_clinician/data_extraction/extract.py $2 $3
echo "DONE"
elif [ "$command" = "preprocess" ]; then
echo "PREPROCESS DATA"
echo "Using final data output directory name (in data/): $2"
echo
echo "1/11 PREPROCESS RAW DATA"
python ai_clinician/preprocessing/01_preprocess_raw_data.py || exit 1
echo "2/11 CALCULATE SEPSIS ONSET"
python ai_clinician/preprocessing/02_calculate_sepsis_onset.py || exit 1
echo "3/11 BUILD PATIENT STATES - SEPSIS COHORT"
python ai_clinician/preprocessing/03_build_patient_states.py data/intermediates/sepsis_cohort --window-before 49 --window-after 25 || exit 1
echo "4/11 IMPUTE STATES - SEPSIS COHORT"
python ai_clinician/preprocessing/04_impute_states.py data/intermediates/sepsis_cohort/patient_states.csv data/intermediates/sepsis_cohort/patient_states_filled.csv --mask-file data/intermediates/sepsis_cohort/state_imputation_mask.csv || exit 1
echo "5/11 BUILD STATES AND ACTIONS - SEPSIS COHORT"
python ai_clinician/preprocessing/05_build_states_and_actions.py data/intermediates/sepsis_cohort/patient_states_filled.csv data/intermediates/sepsis_cohort/qstime.csv data/intermediates/sepsis_cohort/states_and_actions.csv --window-before 49 --window-after 25 --mapping-file data/intermediates/sepsis_cohort/bin_mapping.csv || exit 1
echo "6/11 IMPUTE STATES AND ACTIONS - SEPSIS COHORT"
python ai_clinician/preprocessing/06_impute_states_actions.py data/intermediates/sepsis_cohort/states_and_actions.csv data/intermediates/sepsis_cohort/states_and_actions_filled.csv --mask-file data/intermediates/sepsis_cohort/states_and_actions_mask.csv || exit 1
echo "7/11 BUILD SEPSIS COHORT"
python ai_clinician/preprocessing/07_build_sepsis_cohort.py data/intermediates/sepsis_cohort/states_and_actions_filled.csv data/intermediates/sepsis_cohort/qstime.csv data/$2 || exit 1
echo "8/11 BUILD PATIENT STATES - MDP"
python ai_clinician/preprocessing/03_build_patient_states.py data/intermediates/mdp --window-before 25 --window-after 49 || exit 1
echo "9/11 IMPUTE STATES - MDP"
python ai_clinician/preprocessing/04_impute_states.py data/intermediates/mdp/patient_states.csv data/intermediates/mdp/patient_states_filled.csv --mask-file data/intermediates/mdp/state_imputation_mask.csv || exit 1
echo "10/11 BUILD STATES AND ACTIONS - MDP"
python ai_clinician/preprocessing/05_build_states_and_actions.py data/intermediates/mdp/patient_states_filled.csv data/intermediates/mdp/qstime.csv data/intermediates/mdp/states_and_actions.csv --window-before 49 --window-after 25 --mapping-file data/intermediates/mdp/bin_mapping.csv || exit 1
echo "11/11 IMPUTE STATES AND ACTIONS - MDP"
python ai_clinician/preprocessing/06_impute_states_actions.py data/intermediates/mdp/states_and_actions.csv data/$2/mimic_dataset.csv --mask-file data/intermediates/mdp/states_and_actions_mask.csv || exit 1
echo "DONE"
elif [ "$command" = "model" ]; then
echo "BUILD MODELS"
echo "Using MIMIC dataset directory (in data/): $2"
echo "Using model output directory (in data/): $3"
echo
echo "GENERATE DATASETS"
python ai_clinician/modeling/01_generate_datasets.py data/$2 data/$3 || exit 1
echo "TRAIN MODELS"
python ai_clinician/modeling/02_train_models.py data/$3 --n-models 100 || exit 1
echo "DONE"
fi