-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_complete_benchmark.sh
More file actions
executable file
·155 lines (132 loc) · 5.6 KB
/
run_complete_benchmark.sh
File metadata and controls
executable file
·155 lines (132 loc) · 5.6 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
# Complete benchmark workflow: Run benchmark + Generate comparison
set -e # Exit on error
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Default values
RUNS=5
EXPERIMENT_NAME="benchmark_$(date +%Y%m%d_%H%M%S)"
ALGORITHMS="MATILDA SPIDER ANYBURL POPPER AMIE3"
DATASETS="Bupa BupaImperfect ComparisonDataset ImperfectTest"
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--runs)
RUNS="$2"
shift 2
;;
--experiment-name)
EXPERIMENT_NAME="$2"
shift 2
;;
--algorithms)
ALGORITHMS="$2"
shift 2
;;
--datasets)
DATASETS="$2"
shift 2
;;
--quick)
RUNS=2
ALGORITHMS="MATILDA SPIDER"
DATASETS="Bupa"
echo -e "${YELLOW}⚡ Quick mode: 2 runs, MATILDA+SPIDER, Bupa only${NC}"
shift
;;
--help)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --runs N Number of runs per algorithm-dataset (default: 5)"
echo " --experiment-name NAME Experiment name (default: benchmark_TIMESTAMP)"
echo " --algorithms \"A1 A2...\" Algorithms to test (default: all)"
echo " --datasets \"D1 D2...\" Datasets to test (default: all)"
echo " --quick Quick test: 2 runs, MATILDA+SPIDER, Bupa only"
echo " --help Show this help"
echo ""
echo "Examples:"
echo " $0 --quick # Quick test"
echo " $0 --runs 10 # Full benchmark with 10 runs"
echo " $0 --algorithms \"MATILDA SPIDER\" # Only MATILDA vs SPIDER"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
echo -e "${BLUE}╔════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ MATILDA Complete Benchmark Workflow ║${NC}"
echo -e "${BLUE}╚════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${GREEN}Configuration:${NC}"
echo " Runs per combination: $RUNS"
echo " Experiment name: $EXPERIMENT_NAME"
echo " Algorithms: $ALGORITHMS"
echo " Datasets: $DATASETS"
echo ""
# Step 1: Run benchmark
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}STEP 1/2: Running Benchmark${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
python3 run_full_benchmark.py \
--runs "$RUNS" \
--experiment-name "$EXPERIMENT_NAME" \
--algorithms $ALGORITHMS \
--datasets $DATASETS
BENCHMARK_EXIT=$?
if [ $BENCHMARK_EXIT -ne 0 ]; then
echo -e "${YELLOW}⚠️ Benchmark completed with errors (exit code: $BENCHMARK_EXIT)${NC}"
echo "Continuing to comparison step..."
else
echo -e "${GREEN}✅ Benchmark completed successfully${NC}"
fi
echo ""
# Step 2: Generate comparison
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}STEP 2/2: Generating Comparison Report${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
python3 compare_matilda_benchmark.py
COMPARISON_EXIT=$?
if [ $COMPARISON_EXIT -ne 0 ]; then
echo -e "${YELLOW}⚠️ Comparison generation failed (exit code: $COMPARISON_EXIT)${NC}"
exit $COMPARISON_EXIT
fi
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}✅ Complete Workflow Finished!${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
# Find the experiment directory
EXP_DIR=$(ls -td data/output/mlruns/*/ | head -1)
if [ -n "$EXP_DIR" ]; then
echo -e "${GREEN}📂 Results Location:${NC}"
echo " $EXP_DIR"
echo ""
echo -e "${GREEN}📄 Generated Files:${NC}"
if [ -f "${EXP_DIR}MATILDA_COMPARISON_REPORT.md" ]; then
echo " ✓ Markdown Report: ${EXP_DIR}MATILDA_COMPARISON_REPORT.md"
fi
if [ -f "${EXP_DIR}matilda_comparison_table.tex" ]; then
echo " ✓ LaTeX Table: ${EXP_DIR}matilda_comparison_table.tex"
fi
if [ -f "${EXP_DIR}matilda_comparison_data.json" ]; then
echo " ✓ JSON Data: ${EXP_DIR}matilda_comparison_data.json"
fi
if [ -f "${EXP_DIR}benchmark_table_*.tex" ]; then
echo " ✓ Benchmark Table: ${EXP_DIR}benchmark_table_*.tex"
fi
echo ""
echo -e "${GREEN}📊 Quick View:${NC}"
echo " cat ${EXP_DIR}MATILDA_COMPARISON_REPORT.md"
fi
echo ""
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"