Debian Codegraph @

scripts/kbcompletion/fb15k237.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 FB15k237
10 DIR=data/Release/
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 on validation:
23
24 pred=data/fb237pred
25 model=data/fb15k237
26 dim=50
27 epoch=10
28 neg=500
29
30 echo "---- train ----"
31 $ft supervised -input $DIR/ft_train.txt \
32 -dim $dim -epoch $epoch -output ${model} -lr .2 -thread 20 -loss ns -neg $neg -minCount 0
33
34 echo "computing filtered hit@10..."
35 $ft predict ${model}.bin $DIR/ft_test.txt 20000 > $pred
36 ./eval $pred ${DIR}/ft_test.txt $DIR/ft_full.txt 10 | awk '{if(NR==2) print "filtered hit@10="$2}'
37
38 echo "---- train+val ----"
39
40 $ft supervised -input $DIR/ft_valid+train.txt \
41 -dim ${dim} -epoch ${dim} -output ${model} -lr .2 -thread 20 -loss ns -neg ${neg} -minCount 0
42
43 echo "computing filtered hit@10..."
44 $ft predict ${model}.bin $DIR/ft_test.txt 20000 > $pred
45 ./eval $pred ${DIR}/ft_test.txt $DIR/ft_full.txt 10 | awk '{if(NR==2) print "filtered hit@10="$2}'