-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain.py
More file actions
31 lines (28 loc) · 1.37 KB
/
train.py
File metadata and controls
31 lines (28 loc) · 1.37 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
from logger import Logger
from streamer_shield import StreamerShield
from streamer_shield_train import train
if __name__ == "__main__":
l= Logger(console_log=True)
layers = [32, 16, 8]
attempt = 5
sequence_len = 30
train("generated_data.csv", f"attempt_{attempt}.h5",f"vocabulary_{attempt}.json", layers=layers, kernel=5, patience = 2, epochs = 10, sequence_len=sequence_len)
ss = StreamerShield(f"attempt_{attempt}.h5", f"vocabulary_{attempt}.json",sequence_len)
correctly_identified_users_bool,correctly_identified_users_conf,correctly_identified_scammers_bool, correctly_identified_scammers_conf = ss.test(False)
user_perc = 0
for user in correctly_identified_users_bool:
if user == True:
user_perc +=1
for scammer in correctly_identified_scammers_bool:
if scammer == True:
user_perc +=1
total_perc = user_perc/(len(correctly_identified_scammers_bool)+ len(correctly_identified_users_bool))
if(total_perc == 1):
l.passingblue(f"Found good candidate with {layers}, stopping!")
l.passing(f'''
Test results:
Users: {correctly_identified_users_bool}
conf: {correctly_identified_users_conf}
Scammer: {correctly_identified_scammers_bool}
conf: {correctly_identified_scammers_conf}
'''.replace(' ', ''))