From 22074d8dbea46fadbd12dafb27a4aa9006d3c7d1 Mon Sep 17 00:00:00 2001 From: Niclas Dobbertin Date: Mon, 26 Feb 2024 20:24:54 +0100 Subject: analysis update --- experiment/analysis/analysis.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 experiment/analysis/analysis.py (limited to 'experiment/analysis/analysis.py') diff --git a/experiment/analysis/analysis.py b/experiment/analysis/analysis.py new file mode 100644 index 0000000..bd2d2b9 --- /dev/null +++ b/experiment/analysis/analysis.py @@ -0,0 +1,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()) -- cgit v1.2.3