-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·139 lines (113 loc) · 6.86 KB
/
run.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
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
#!/usr/bin/env bash
# Usage: ./run.sh {trace}
trace=${1} # valid values: "caida", "mawi", "uni"
#############################
# SETUP
#############################
data_folder="./data/"
results_folder="./results/"
eval "$(conda shell.bash hook)"
conda activate ./conda_envs/training_env
chmod +x ./scripts/*/*.sh
chmod +x ./scripts/*/*.out
#############################
# PCAP TRACES PREPROCESSING
#############################
./scripts/preprocessing/pcap_parsing.sh $data_folder $trace
./scripts/preprocessing/features_extraction.sh $data_folder $trace
#############################
# MODELS TRAINING AND TESTING
#############################
# Models for single protocol
if [[ "$trace" == "uni" ]]; then
echo "Skipping single-protocol models for UNI trace.";
else
./scripts/models/training.sh $data_folder $results_folder $trace "tcp" 1 none 0 0
./scripts/models/training.sh $data_folder $results_folder $trace "udp" 1 none 0 0
./scripts/models/training.sh $data_folder $results_folder $trace "icmp" 1 none 0 0
fi
# Models for TCP
if [[ "$trace" == "caida" ]]; then
./scripts/models/training.sh $data_folder $results_folder $trace "tcp" 5 pruning+feat_selection+quantization 0 0
./scripts/models/pheavy.sh $data_folder $results_folder $trace "tcp" 0
fi
# Models for TCP+UDP
./scripts/models/training.sh $data_folder $results_folder $trace "tcp_udp" 5 pruning+feat_selection+quantization 0 0
./scripts/models/training.sh $data_folder $results_folder $trace "tcp_udp" 1 pruning+feat_selection+quantization 0 0
./scripts/models/training.sh $data_folder $results_folder $trace "tcp_udp" 5 ultrapruning+feat_selection+quantization "${results_folder}/5_pk/tcp_udp/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/training.sh $data_folder $results_folder $trace "tcp_udp" 5 feat_selection+quantization "${results_folder}/5_pk/tcp_udp/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/training.sh $data_folder $results_folder $trace "tcp_udp" 5 none "${results_folder}/5_pk/tcp_udp/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/training.sh $data_folder $results_folder $trace "tcp_udp" 1 none "${results_folder}/1_pk/tcp_udp/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/pheavy.sh $data_folder $results_folder $trace "tcp_udp" 0
# Models for TCP+UDP+ICMP
./scripts/models/training.sh $data_folder $results_folder $trace "all_proto" 5 pruning+feat_selection+quantization 0 0
./scripts/models/training.sh $data_folder $results_folder $trace "all_proto" 1 pruning+feat_selection+quantization 0 0
./scripts/models/training.sh $data_folder $results_folder $trace "all_proto" 5 ultrapruning+feat_selection+quantization "${results_folder}/5_pk/all_proto/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/training.sh $data_folder $results_folder $trace "all_proto" 5 feat_selection+quantization "${results_folder}/5_pk/all_proto/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/training.sh $data_folder $results_folder $trace "all_proto" 5 none "${results_folder}/5_pk/all_proto/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/training.sh $data_folder $results_folder $trace "all_proto" 1 none "${results_folder}/1_pk/all_proto/initial5min_pruning+feat_selection+quantization_0dryrun_${trace}/rs_cv_results.csv" 0 random
./scripts/models/pheavy.sh $data_folder $results_folder $trace "all_proto" 0
#############################
# USE CASES SIMULATIONS
#############################
# Prepare models for use cases simulations (DUMBO ONNX and pHeavy confusion matrix)
./scripts/models/sklearn2onnx.sh $data_folder $results_folder $trace "tcp_udp" 5 pruning+feat_selection+quantization
./scripts/models/confusion_matrix.sh $results_folder $trace "tcp_udp" 5
if [[ "$trace" == "caida" ]]; then
./scripts/models/sklearn2onnx.sh $data_folder $results_folder $trace "tcp" 5 pruning+feat_selection+quantization
./scripts/models/confusion_matrix.sh $results_folder $trace "tcp" 5
fi
# Simulations setup. Warning: first, deactivate anaconda with `conda deactivate` (Rust constraint)
conda deactivate
./scripts/preprocessing/init_trace_dir.sh $data_folder $trace
./scripts/preprocessing/preprocess_es.sh $trace "tcp_udp"
if [[ "$trace" == "caida" ]]; then
./scripts/preprocessing/preprocess_es.sh $trace "tcp"
fi
conda activate ./conda_envs/training_env
./scripts/preprocessing/preprocess_synth.sh $results_folder $trace "tcp_udp" && wait
if [[ "$trace" == "caida" ]]; then
./scripts/preprocessing/preprocess_synth.sh $results_folder $trace "tcp" && wait
fi
# Flow size estimation
conda deactivate
./scripts/use_cases/script_fse.sh $results_folder $trace "tcp_udp" 5 pruning+feat_selection+quantization
if [[ "$trace" == "caida" ]]; then
./scripts/use_cases/script_fse.sh $results_folder $trace "tcp" 5 pruning+feat_selection+quantization
fi
# Inter-arrival time
./scripts/use_cases/script_iat.sh $results_folder $trace "tcp_udp" 5 pruning+feat_selection+quantization
if [[ "$trace" == "caida" ]]; then
./scripts/use_cases/script_iat.sh $results_folder $trace "tcp" 5 pruning+feat_selection+quantization
fi
# Scheduling. Warning: first, apply the scheduling_DUMBO.patch on the YAPS repository.
conda activate ./conda_envs/training_env
./scripts/preprocessing/extract_cdf.sh $data_folder $trace # Extract the trace CDF for the simulator
mkdir ./simulator/py/$trace
cp $data_folder/$trace/CDF_$trace.txt ./simulator/py/
conda activate ./conda_envs/scheduling_env
./scripts/use_cases/script_scheduling.sh $results_folder $data_folder $trace
#############################
# MISPREDICTIONS ANALYSIS
#############################
# Synthetically simulate various DUMBO performances. Warning: runs only on the CAIDA trace
if [[ "$trace" == "caida" ]]; then
echo "Running sensitivity analysis..."
conda deactivate
# Flow size estimation
./scripts/use_cases/script_fse_synth.sh "caida" "tcp_udp"
./scripts/use_cases/script_fse_synth.sh "caida" "tcp"
# IAT estimation
./scripts/use_cases/script_iat_synth.sh "caida" "tcp_udp"
./scripts/use_cases/script_iat_synth.sh "caida" "tcp"
# Scheduling
conda activate ./conda_envs/training_env
./scripts/preprocessing/extract_cdf.sh $data_folder "caida" # Extract the trace CDF for the simulator
mkdir ./simulator/py/$trace
cp $data_folder/$trace/CDF_$trace.txt ./simulator/py/
mkdir ./simulator/py/synth
conda activate ./conda_envs/scheduling_env
./scripts/use_cases/script_scheduling_synth.sh $results_folder $data_folder
conda activate ./conda_envs/scheduling_env
./scripts/use_cases/script_scheduling_synth.sh $results_folder $data_folder
fi