-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
70 lines (51 loc) · 2.13 KB
/
main.py
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
# Author: Gaël LINKEU
# Purpose: Master Thesis
# Year: 2023
# Iteratively execution of the approach
# 1- Initialize the machine and get the datasets
# 2- Train the RNN
# 3- Construct and merge the prefix tree
import os
import argparse
import random
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--n_machines", type=int, default=1)
parser.add_argument("--times", type=int, default=1)
return parser.parse_args()
# Study the quality of the finally machine per similarity threshold
def threshold_study():
args = parse_args()
sim_thresholds = [0.2, 0.4, 0.6, 0.8, 0.9, 0.95]
n_machines = args.n_machines
for j in range(args.times):
print(f'\n\n The times: {j+1}\n\n')
for i in range(n_machines):
id = i
times = j
os.system(f'python fsm_initialization.py --id={id} --n_states={id+2}')
os.system(f'python train_rnn.py --id={id}')
for sim_threshold in sim_thresholds:
os.system(f'python extract_mealy.py --id={id} --sim_threshold={sim_threshold}')
if __name__ == "__main__":
args = parse_args()
os.system(f'python fsm_initialization.py --id={0}')
os.system(f'python train_rnn.py --id={0}')
os.system(f'python extract_mealy.py --id={0}')
# Experiment multiples times on the same dataset
# n_machines = args.n_machines
# for j in range(1):
# for i in range(n_machines):
# os.system(f'python fsm_initialization.py --id={i} --n_states={i+2}')
# os.system(f'python train_rnn.py --id={i} --times={j+1}')
# os.system(f'python extract_mealy.py --id={i} --times={j+1}')
# Experiment one time
# for i in range(10):
# os.system(f'python fsm_initialization.py --id={i}')
# os.system(f'python train_rnn.py --id={i}')
# os.system(f'python extract_mealy.py --id={i}')
#Experiment multiple times on different datasets
# for i in range(10):
# os.system(f'python fsm_initialization.py --id={i} --static=0')
# os.system(f'python train_rnn.py --id={i}')
# os.system(f'python extract_mealy.py --id={i}')