Skip to content

Commit

Permalink
do not discard ordering of encountered samples in payoff distrs
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed Nov 27, 2019
1 parent 7704a05 commit f09dece
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sp_experiment/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,10 @@ def log_data(fpath, onset='n/a', duration=0, trial='n/a', action='n/a',
if isinstance(payoff_dict, dict):
setting = list()
for i in range(2):
# NOTE: the use of "set" discards the ordering of values in the
# payoff distributions
for out_i in list(set(payoff_dict[i])):
sampled_outs = np.array(payoff_dict[i])
_, idx = np.unique(sampled_outs, return_index=True)
unique_sampled_outs = sampled_outs[np.sort(idx)]
for out_i in unique_sampled_outs:
prob_i = payoff_dict[i].count(out_i) / len(payoff_dict[i])
setting.append(out_i)
setting.append(prob_i)
Expand Down

0 comments on commit f09dece

Please sign in to comment.