-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconflicts_compare.py
33 lines (25 loc) · 978 Bytes
/
conflicts_compare.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
import pandas as pd
from tqdm import tqdm
from model.experiment_utils import sentences, delays, betrayal_probas, num_prisioners
from plots import get_conflicts, search_experiment_results
def compare(conflicts):
num_buchoneado = [0] * num_prisioners
num_buchonea = [0] * num_prisioners
for conflict in conflicts:
num_buchoneado[conflict['buchoneado']-1] +=1
num_buchonea[conflict['buchon']-1] +=1
return zip(num_buchoneado, num_buchonea)
def process(c,d,p):
return pd.DataFrame([
(buchoneado, buchonea, c, d, p)
for df in search_experiment_results(c, d, p)
for buchoneado, buchonea in compare(get_conflicts(df))
], columns=['buchoneado', 'buchonea', 'c', 'd', 'p'])
all_experiments = [
(c,d,p)
for c in sentences
for d in delays
for p in betrayal_probas
]
num_conflicts = pd.concat([process(c,d,p) for c,d,p in tqdm(all_experiments)])
num_conflicts.to_csv('conflicts_compare.csv', index=False)