| 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 SVO |
| 10 |
DIR=data/SVO-tensor-dataset |
| 11 |
FASTTEXTDIR=../../ |
| 12 |
|
| 13 |
# compile |
| 14 |
pushd $FASTTEXTDIR |
| 15 |
make opt |
| 16 |
popd |
| 17 |
ft=${FASTTEXTDIR}/fasttext |
| 18 |
|
| 19 |
## Train model and test it on validation: |
| 20 |
|
| 21 |
dim=200 |
| 22 |
epoch=3 |
| 23 |
model=svo |
| 24 |
|
| 25 |
echo "---- train ----" |
| 26 |
time $ft supervised -input ${DIR}/ft_svo_data_train_1000000.dat \ |
| 27 |
-dim $dim -epoch $epoch -output ${model} -lr .2 -thread 20 |
| 28 |
|
| 29 |
echo "computing raw hit@5%..." |
| 30 |
$ft test ${model}.bin ${DIR}/ft_svo_data_test_250000.dat 227 2> /dev/null | awk '{if(NR==3) print "raw hit@5%="$2}' |
| 31 |
|
| 32 |
|
| 33 |
echo "---- train + valid ----" |
| 34 |
time $ft supervised -input ${DIR}/ft_svo_data-valid+train.dat \ |
| 35 |
-dim $dim -epoch $epoch -output ${model} -lr .2 -thread 20 |
| 36 |
|
| 37 |
echo "computing raw hit@5%..." |
| 38 |
$ft test ${model}.bin ${DIR}/ft_svo_data_test_250000.dat 227 2> /dev/null | awk '{if(NR==3) print "raw hit@5%="$2}' |