-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscore_medspacy.sh
executable file
·94 lines (75 loc) · 3.44 KB
/
score_medspacy.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/zsh
export ENSEMBLE_DIR=/Users/pmh/git/ots-ensemble-systems/medspaCy
export ENSEMBLE_CONDA=~/opt/anaconda3/envs/ensemble-py3.8
export ETUDE_DIR=/Users/pmh/git/etude
export ETUDE_CONDA=~/opt/anaconda3/envs/etude-py3.7
export CONFIG_DIR=/Users/pmh/git/etude-engine-configs/uima
export RESULT_DIR=/Users/pmh/git/ots-ensemble-systems/data/out
export TASK=2019_n2c2_track3
export RESULT_FILE=/Users/pmh/git/ots-ensemble-systems/data/out/${TASK}/${TASK}_results.csv
export INPUT_TEXT_DIR=~/data/n2c2/2019_n2c2_track-3/test/test_note
export INPUT_NORM_DIR=~/data/n2c2/2019_n2c2_track-3/test/test_norm
export INPUT_SYSTEMS_DIR=~/data/n2c2/2019_n2c2_track-3/top10_outputs
export INPUT_FILE_LIST=~/data/n2c2/2019_n2c2_track-3/test/test_file_list.txt
##export INPUT_FILE_LIST=~/data/n2c2/2019_n2c2_track-3/test/first_file.txt
export MERGED_DIR=${RESULT_DIR}/${TASK}/merged
export REF_DIR=${RESULT_DIR}/${TASK}/ref
if [[ -z $TEAMS ]]; then
export TEAMS=1234567890
fi
if [[ -z $MAXVOTES ]]; then
export MAXVOTES=10
fi
export MINVOTES=1
export METHOD=oracle
export SYS_DIR=${RESULT_DIR}/${TASK}/${METHOD}/${TEAMS}
mkdir -p ${SYS_DIR}
## TODO - we only need to run the ref-dir creation once so figure
## out an elegant way to have it trigger only the first time
## --ref-dir ${REF_DIR} \
python3 ${ENSEMBLE_DIR}/oracleEnsemble.py \
--input-dir ${MERGED_DIR} \
--classifier-list ${TEAMS} \
--output-dir ${SYS_DIR} \
--file-list ${INPUT_FILE_LIST}
${ETUDE_CONDA}/bin/python3 ${ETUDE_DIR}/etude.py \
--reference-conf ${CONFIG_DIR}/ensemble_note-nlp_xmi.conf \
--reference-input ${REF_DIR} \
--test-conf ${CONFIG_DIR}/ensemble_note-nlp_xmi.conf \
--test-input ${SYS_DIR} \
--file-suffix ".xmi" \
--fuzzy-match-flags exact \
--score-normalization note_nlp_source_concept_id \
--metrics Accuracy TP FP FN TN \
> ${RESULT_DIR}/${TASK}/etude/${METHOD}_${MINVOTES}_${TEAMS}.log
export COVERAGE=`grep micro ${RESULT_DIR}/${TASK}/etude/${METHOD}_${MINVOTES}_${TEAMS}.log | cut -f 2 | head -n 1 | tr '\n' '\t'`
export ACCURACY=`grep micro ${RESULT_DIR}/${TASK}/etude/${METHOD}_${MINVOTES}_${TEAMS}.log | cut -f 2 | tail -n 1 | tr '\n' '\t'`
echo "${METHOD} ${TEAMS} ${ACCURACY}${COVERAGE}${MINVOTES}" \
>> ${RESULT_FILE}
export METHOD=voting
for MINVOTES in {1..${MAXVOTES}}
do
export SYS_DIR=${RESULT_DIR}/${TASK}/${METHOD}/${MINVOTES}_${TEAMS}
mkdir -p ${SYS_DIR}
python3 ${ENSEMBLE_DIR}/votingEnsemble.py \
--input-dir ${MERGED_DIR} \
--classifier-list ${TEAMS} \
--min-votes ${MINVOTES} \
--zero-strategy drop \
--output-dir ${SYS_DIR} \
--file-list ${INPUT_FILE_LIST}
${ETUDE_CONDA}/bin/python3 ${ETUDE_DIR}/etude.py \
--reference-conf ${CONFIG_DIR}/ensemble_note-nlp_xmi.conf \
--reference-input ${REF_DIR} \
--test-conf ${CONFIG_DIR}/ensemble_note-nlp_xmi.conf \
--test-input ${SYS_DIR} \
--file-suffix ".xmi" \
--fuzzy-match-flags exact \
--score-normalization note_nlp_source_concept_id \
--metrics Accuracy TP FP FN TN \
> ${RESULT_DIR}/${TASK}/etude/${METHOD}_${MINVOTES}_${TEAMS}.log
export COVERAGE=`grep micro ${RESULT_DIR}/${TASK}/etude/${METHOD}_${MINVOTES}_${TEAMS}.log | cut -f 2 | head -n 1 | tr '\n' '\t'`
export ACCURACY=`grep micro ${RESULT_DIR}/${TASK}/etude/${METHOD}_${MINVOTES}_${TEAMS}.log | cut -f 2 | tail -n 1 | tr '\n' '\t'`
echo "${METHOD} ${TEAMS} ${ACCURACY}${COVERAGE}${MINVOTES}" \
>> ${RESULT_FILE}
done