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())