-
Notifications
You must be signed in to change notification settings - Fork 0
/
learning_curve.sh
executable file
·46 lines (33 loc) · 1.43 KB
/
learning_curve.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
function learning_curve() {
$ML_FRAMEWORK_DIR/log.sh INFO "Starting calculating a learning curve..."
run_dir=${params[RUN_DIR]}
train_sample_sizes=${params[TRAIN_SAMPLE_SIZES]}
train_data=${params[TRAIN_DATA]}
ml_params=${params[ML_PARAMS]}
i=0
for sample_size in $train_sample_sizes; do
iter=`printf "%03d" $i`
iter_name="$iter"_sample_$sample_size
mkdir -p $run_dir/$iter_name
echo $sample_size > $run_dir/$iter_name/stats
run_in_parallel \
"$ML_FRAMEWORK_DIR/lc_iter.sh -f $config_file \
TRAIN_SAMPLE_SIZE=$sample_size \
RUN_DIR=$run_dir/$iter_name; \
touch $run_dir/done.$iter_name" \
"lc_iter.$sample_size" -50 $run_dir/log 0
((i++))
done
wait_for_jobs "$run_dir/done.*" $i
############################ Collecting statistics #########################
# all numbers
paste $run_dir/*_sample_*/stats >> $run_dir/stats.numbers
# a header used for sample results
echo "TRAIN_SAMPLE" > $run_dir/stats.header
print_header $run_dir/stats.numbers "TRAIN" "TEST" >> $run_dir/stats.header
echo -e "ML_METHOD:\t" ${params[ML_METHOD]} ${params[ML_PARAMS]} > $run_dir/stats
paste $run_dir/stats.header $run_dir/stats.numbers >> $run_dir/stats
sed -i 's/$/|/' $run_dir/stats
rm $run_dir/stats.header $run_dir/stats.numbers
}