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 pathlib import Path
from pprint import pprint
import tools
data_path = Path("/home/niclas/repos/uni/master_thesis/experiment/data")
procedures = ["1", "2", "3", "4", "5", "6", "overall"]
conditions = [x.stem for x in data_path.iterdir() if x.is_dir()]
data = {}
for condition in conditions:
data[condition] = {}
for vp in (data_path / condition).iterdir():
data[condition][vp.stem] = tools.unpickle(vp / "vp.pkl")
data_train, data_test = tools.train_test_split(data)
print(data_train["random"]["vp12"])
condition = "random"
df = pd.DataFrame([tools.total_accuracy(data[condition][vp], procedures) for vp in data[condition].keys()], index=data[condition].keys(), columns=["train", "test"])
condition = "random"
proc_accs = [
tools.count_correct(data[condition][vp], data[condition][vp].keys(), procedures)
for vp in data[condition].keys()
]
for vp in proc_accs:
for proc in vp.keys():
vp[proc] /= len(next(iter(data[condition].values())).keys())
df = pd.DataFrame(proc_accs, index=data[condition].keys())
|