diff options
author | Niclas Dobbertin <niclas.dobbertin@mailbox.org> | 2024-02-26 20:24:54 +0100 |
---|---|---|
committer | Niclas Dobbertin <niclas.dobbertin@mailbox.org> | 2024-02-26 20:24:54 +0100 |
commit | 22074d8dbea46fadbd12dafb27a4aa9006d3c7d1 (patch) | |
tree | acd3f2845175ea7f1831c9f145ce9282ce757f6e /experiment/analysis/analysis.py | |
parent | e381a1e64ddb9e3bacba25389214cfd4756bba06 (diff) |
analysis update
Diffstat (limited to 'experiment/analysis/analysis.py')
-rw-r--r-- | experiment/analysis/analysis.py | 33 |
1 files changed, 33 insertions, 0 deletions
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()) |