-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-tests
executable file
·93 lines (71 loc) · 1.8 KB
/
run-tests
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
#!/bin/bash
##################################################
# Initialization
# Document-topic similarity.
# Defaults to number of topics.
alpha_values="1 10 100 500 1000"
# Document-word similarity.
# Defaults to 0.01.
beta_values="0.0001 0.001 0.01 0.1 0.5 1.0"
# Number of topics to infer.
topic_values="100 250 500 750 1000"
# Number of iterations to run.
iter_values="3000"
# Initialize run counter.
run=1
##################################################
# Environment setup
# Check for errors.
set +e
# Create results directory.
rm -rf results
mkdir -p results logs
# Create backup database.
cp data.db data.db.bkp
##################################################
# Execution
run_experiment() {
local run=$1
local alpha=$2
local beta=$3
local topics=$4
local iter=$5
# Print run information.
date +%Y.%m.%d.%H.%M.%S
echo "> run: $run"
echo "> alpha: $alpha"
echo "> beta: $beta"
echo "> topics: $topics"
echo "> iter: $iter"
# Learn.
echo "Learning."
bin/learn -threads 8 \
-iterations $iter \
-alpha $alpha \
-beta $beta \
-topics $topics \
-words 10 \
-in data \
-out results &>> "logs/learn-$run.log"
}
# Iterate through values.
for alpha in $alpha_values; do
for beta in $beta_values; do
for topics in $topic_values; do
for iter in $iter_values; do
# Delay experiment creation time.
sleep 2
# Fork experiment to background.
run_experiment $run $alpha $beta $topics $iter &
run=$((run + 1))
done
done
done
done | tee -a run-tests.log
# # Read in results.
# echo "Importing results."
# bin/scrape import-results \
# --topic-file results/*/topics.csv \
# --course-file results/*/documents.csv \
# --alpha $alpha --beta $beta --iterations $iter
exit