@@ -117,7 +117,7 @@ def compute_state_distribution(interactions):
117
117
118
118
def compute_normalised_state_distribution (interactions ):
119
119
"""
120
- Returns the normalized count of each state for a set of interactions.
120
+ Returns the normalised count of each state for a set of interactions.
121
121
122
122
Parameters
123
123
----------
@@ -127,8 +127,8 @@ def compute_normalised_state_distribution(interactions):
127
127
128
128
Returns
129
129
----------
130
- normalized_count : Counter Object
131
- Dictionary where the keys are the states and the values are a normalized
130
+ normalised_count : Counter Object
131
+ Dictionary where the keys are the states and the values are a normalised
132
132
count of the number of times that state occurs.
133
133
"""
134
134
if not interactions :
@@ -137,10 +137,10 @@ def compute_normalised_state_distribution(interactions):
137
137
interactions_count = Counter (interactions )
138
138
total = sum (interactions_count .values (), 0 )
139
139
140
- normalized_count = Counter (
140
+ normalised_count = Counter (
141
141
{key : value / total for key , value in interactions_count .items ()}
142
142
)
143
- return normalized_count
143
+ return normalised_count
144
144
145
145
146
146
def compute_state_to_action_distribution (interactions ):
@@ -213,14 +213,14 @@ def compute_normalised_state_to_action_distribution(interactions):
213
213
-------
214
214
normalised_state_to_C_distributions : List of Counter Object
215
215
List of Counter objects where the keys are the states and actions and
216
- the values the normalized counts. The first/second Counter corresponds
216
+ the values the normalised counts. The first/second Counter corresponds
217
217
to the first/second player.
218
218
"""
219
219
if not interactions :
220
220
return None
221
221
222
222
distribution = compute_state_to_action_distribution (interactions )
223
- normalized_distribution = []
223
+ normalised_distribution = []
224
224
for player in range (2 ):
225
225
counter = {}
226
226
for state in [(C , C ), (C , D ), (D , C ), (D , D )]:
@@ -232,8 +232,8 @@ def compute_normalised_state_to_action_distribution(interactions):
232
232
counter [(state , C )] = C_count / (C_count + D_count )
233
233
if D_count > 0 :
234
234
counter [(state , D )] = D_count / (C_count + D_count )
235
- normalized_distribution .append (Counter (counter ))
236
- return normalized_distribution
235
+ normalised_distribution .append (Counter (counter ))
236
+ return normalised_distribution
237
237
238
238
239
239
def sparkline (actions , c_symbol = "█" , d_symbol = " " ):
0 commit comments