-
Notifications
You must be signed in to change notification settings - Fork 0
/
RunWapiti_dev.sh
33 lines (28 loc) · 1.87 KB
/
RunWapiti_dev.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
Wapiti=/public/home/yangjs/test/CRF_test/Wapiti/bin/wapiti
Pattern_File=test.pat
Training_Options=' -a sgd-l1 -t 4 -i 15 '
mkdir -p output
echo "================ Training (this may take some time) ================" 1>&2
# training: create a MODEL based on PATTERNS and TRAINING-CORPUS
# wapiti train -p PATTERNS TRAINING-CORPUS MODEL
echo "wapiti train $training_options -p $pattern_file <(cat AGAC_training_tab_part1/*.tab) output/train.mod" 1>&2
$Wapiti train $Training_Options -p $Pattern_File <(cat AGAC_training_tab_part1/*.tab) output/train.mod
# wapiti train -a bcd -t 2 -i 5 -p t.pat train-bio.tab t-train-bio.mod
#
# Note: The default algorithm, l-bfgs, stops early and does not succeed in annotating any token (all O)
# sgd-l1 works; bcd works
# To examine the contents of the model, first dump it into a text file then use 'less FILE' to view its contents
$Wapiti dump output/train.mod output/train.txt
echo "================ Inference ================" 1>&2
# inference (labeling): apply the MODEL to label the TEST-CORPUS, put results in TEST-RESULTS
# wapiti label -m MODEL TEST-CORPUS TEST-RESULTS
# -c : check (= evaluate)
# <(COMMAND ARGUMENTS ...) : runs COMMAND on ARGUMENTS ... and provides the results as if in a file
echo "wapiti label -c -m output/train.mod <(cat AGAC_training_tab_part2/*.tab) output/train-test.tab" 1>&2
$Wapiti label -c -m output/train.mod <(cat AGAC_training_tab_part2/*.tab) output/train-test.tab
# wapiti label -c -m t-train-bio.mod test-bio.tab t-train-test-bio.tab
echo "================ Evaluation with conlleval.pl $corpus_name ================" 1>&2
# evaluate the resulting entities
# $'\t' is a way to obtain a tabulation in bash
echo "perl conlleval.pl -d $'\t' <$output_dir/$patname-train-test-$corpus_name.tab | tee $output_dir/$patname-train-test-$corpus_name.eval" 1>&2
perl conlleval.pl -d $'\t' <output/train-test.tab | tee output/train-test.eva