-
Notifications
You must be signed in to change notification settings - Fork 0
/
WIP_worksheet_stability_check.py
112 lines (91 loc) · 3.77 KB
/
WIP_worksheet_stability_check.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
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
import numpy as np
import agent as ag
from simulation import Simulation
# WORK IN PROGRESS
initial_trust_human_to_AI = 0.46
update_up_alfa_human_to_AI = 0.007
update_down_beta_human_to_AI = 0.2
ag.initial_trust_human_to_AI = initial_trust_human_to_AI
ag.update_up_alfa_human_to_AI = update_up_alfa_human_to_AI
ag.update_down_beta_human_to_AI = update_down_beta_human_to_AI
epsilon = 0.0001
def calculate_score(sim: Simulation, last_n=1):
return np.mean((sim.error_over_time_RTSI[-last_n:]))
def check_stability(sim1: Simulation, sim2: Simulation):
error1 = calculate_score(sim1)
error2 = calculate_score(sim2)
return {
# 'sim1': copy.deepcopy(sim1),
# 'sim2': copy.deepcopy(sim2),
'error1': error1,
'error2': error2,
'result': abs(error1 - error2) < epsilon
}
s_baseline = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_baseline.run()
result = []
ag.initial_trust_human_to_AI = initial_trust_human_to_AI + epsilon
s_disturbed = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_disturbed.run()
result.append(check_stability(s_baseline, s_disturbed))
ag.initial_trust_human_to_AI = initial_trust_human_to_AI - epsilon
s_disturbed = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_disturbed.run()
result.append(check_stability(s_baseline, s_disturbed))
ag.initial_trust_human_to_AI = initial_trust_human_to_AI
#########
ag.update_up_alfa_human_to_AI = update_up_alfa_human_to_AI + epsilon
s_disturbed = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_disturbed.run()
result.append(check_stability(s_baseline, s_disturbed))
ag.update_up_alfa_human_to_AI = update_up_alfa_human_to_AI - epsilon
s_disturbed = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_disturbed.run()
result.append(check_stability(s_baseline, s_disturbed))
ag.update_up_alfa_human_to_AI = update_up_alfa_human_to_AI
#########
ag.update_down_beta_human_to_AI = update_down_beta_human_to_AI + epsilon
s_disturbed = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_disturbed.run()
result.append(check_stability(s_baseline, s_disturbed))
ag.update_down_beta_human_to_AI = update_down_beta_human_to_AI - epsilon
s_disturbed = Simulation(the_same_initial_temp_everywhere=False,
is_bidirectional=False,
periods=300,
agents=100,
neighbours=5,
random_state=5)
s_disturbed.run()
result.append(check_stability(s_baseline, s_disturbed))
ag.update_down_beta_human_to_AI = update_down_beta_human_to_AI
s_disturbed.draw_chart_error_wrt_ground_truth("test")