From 038dda98f7f64af5fd86e50f83c2515dd3f78515 Mon Sep 17 00:00:00 2001
From: Pat Alt <55311242+pat-alt@users.noreply.github.com>
Date: Tue, 12 Sep 2023 07:28:49 +0200
Subject: [PATCH] quick result inspection

---
 .../post_processing/post_processing.jl        |  3 +-
 experiments/post_processing/results.jl        | 50 +++++++++++++++++++
 experiments/setup_env.jl                      |  3 +-
 3 files changed, 54 insertions(+), 2 deletions(-)
 create mode 100644 experiments/post_processing/results.jl

diff --git a/experiments/post_processing/post_processing.jl b/experiments/post_processing/post_processing.jl
index 7eefa387..f70aabe4 100644
--- a/experiments/post_processing/post_processing.jl
+++ b/experiments/post_processing/post_processing.jl
@@ -1,2 +1,3 @@
 include("meta_data.jl")
-include("artifacts.jl")
\ No newline at end of file
+include("artifacts.jl")
+include("results.jl")
\ No newline at end of file
diff --git a/experiments/post_processing/results.jl b/experiments/post_processing/results.jl
new file mode 100644
index 00000000..1c7578a3
--- /dev/null
+++ b/experiments/post_processing/results.jl
@@ -0,0 +1,50 @@
+"""
+    plausibility(outcome::ExperimentOutcome)
+
+Helper function to quickly filter a benchmark table for the distance from targets: the smaller this distance, the higher the plausibility.
+"""
+function plausibility(outcome::ExperimentOutcome)
+    bmk = outcome.bmk
+    df = @chain bmk() begin
+        @group_by(dataname, generator, model, variable)
+        @summarize(mean=mean(value),sd=std(value))
+        @filter(variable == "distance_from_targets")
+        @ungroup
+        @arrange(mean)
+    end
+    return df
+end
+
+"""
+    faithfulness(outcome::ExperimentOutcome)
+
+Helper function to quickly filter a benchmark table for the distance from energy: the smaller this distance, the higher the faithfulness.
+"""
+function faithfulness(outcome::ExperimentOutcome)
+    bmk = outcome.bmk
+    df = @chain bmk() begin
+        @group_by(dataname, generator, model, variable)
+        @summarize(mean=mean(value),sd=std(value))
+        @filter(variable == "distance_from_energy")
+        @ungroup
+        @arrange(mean)
+    end
+    return df
+end
+
+"""
+    closeness(outcome::ExperimentOutcome)
+
+Helper function to quickly filter a benchmark table for the distance from the factual: the smaller this distance, the higher the closeness desideratum.
+"""
+function closeness(outcome::ExperimentOutcome)
+    bmk = outcome.bmk
+    df = @chain bmk() begin
+        @group_by(dataname, generator, model, variable)
+        @summarize(mean=mean(value),sd=std(value))
+        @filter(variable == "distance")
+        @ungroup
+        @arrange(mean)
+    end
+    return df
+end
\ No newline at end of file
diff --git a/experiments/setup_env.jl b/experiments/setup_env.jl
index fc9217a1..b9fda882 100644
--- a/experiments/setup_env.jl
+++ b/experiments/setup_env.jl
@@ -25,6 +25,8 @@ using Random
 using Serialization
 using TidierData
 
+import MPI
+
 Random.seed!(2023)
 
 ENV["DATADEPS_ALWAYS_ACCEPT"] = "true"              # avoid command prompt and just download data
@@ -48,7 +50,6 @@ else
 end
 
 if "mpi" ∈ ARGS
-    import MPI
     MPI.Init()
     const USE_MPI = true
     plz = MPIParallelizer(MPI.COMM_WORLD; threaded=USE_THREADS)
-- 
GitLab