Debian Codegraph @

scripts/kbcompletion/wn18.sh

raw
1 #!/usr/bin/env bash
2 #
3 # copyright (c) 2017-present, facebook, inc.
4 # all rights reserved.
5 #
6 # this source code is licensed under the MIT license found in the
7 # license file in the root directory of this source tree.
8 #
9 # script for WN11
10 DIR=data/wordnet-mlj12/
11 FASTTEXTDIR=../../
12
13 # compile
14
15 pushd $FASTTEXTDIR
16 make opt
17 popd
18 ft=${FASTTEXTDIR}/fasttext
19
20 g++ -std=c++0x eval.cpp -o eval
21
22 # Train model and test it:
23 dim=100
24 epoch=100
25 neg=500
26 model=data/wn
27 pred=data/wnpred
28
29 echo "---- train ----"
30 $ft supervised -input ${DIR}/ft_wordnet-mlj12-train.txt \
31 -dim $dim -epoch $epoch -output ${model} -lr .2 -thread 20 -loss ns -neg $neg
32
33 echo "computing raw hits@10..."
34 $ft test ${model}.bin ${DIR}/ft_wordnet-mlj12-test.txt 10 2> /dev/null | awk '{if(NR==3) print "raw hit@10 = "$2}'
35
36 echo "computing filtered hit@10..."
37 $ft predict ${model}.bin ${DIR}/ft_wordnet-mlj12-test.txt 20000 > $pred
38 ./eval $pred ${DIR}/ft_wordnet-mlj12-test.txt $DIR/ft_wordnet-mlj12-full.txt 10 | awk '{if(NR==2) print "filtered hit@10 = "$2}'
39
40 echo "---- train+val ----"
41 $ft supervised -input ${DIR}/ft_wordnet-mlj12-valid+train.txt \
42 -dim $dim -epoch $epoch -output ${model} -lr .2 -thread 20 -loss ns -neg $neg
43
44 echo "computing raw hits@10..."
45 $ft test ${model}.bin ${DIR}/ft_wordnet-mlj12-test.txt 10 2> /dev/null | awk '{if(NR==3) print "raw hit@10 = "$2}'
46
47 echo "computing filtered hit@10..."
48 $ft predict ${model}.bin ${DIR}/ft_wordnet-mlj12-test.txt 20000 > $pred
49 ./eval $pred ${DIR}/ft_wordnet-mlj12-test.txt $DIR/ft_wordnet-mlj12-full.txt 10 | awk '{if(NR==2) print "filtered hit@10 = "$2}'