From 4841c1d181e2dc53a2dda2f4f92e4234a9a9321c Mon Sep 17 00:00:00 2001
From: kohlhaasrebecca <rebecca.kohlhaas@outlook.com>
Date: Wed, 24 Apr 2024 15:42:55 +0200
Subject: [PATCH] Create class 'SequentialDesign'

---
 docs/diagrams/.$Structure_BayesInf.drawio.bkp |  964 +++++++++
 docs/diagrams/Structure_BayesInf.drawio       |  964 +++++++++
 .../example_analytical_function.py            |    6 +
 src/bayesvalidrox/surrogate_models/engine.py  |   69 +-
 .../surrogate_models/sequential_design.py     | 1716 +++++++++++++++++
 5 files changed, 3674 insertions(+), 45 deletions(-)
 create mode 100644 docs/diagrams/.$Structure_BayesInf.drawio.bkp
 create mode 100644 docs/diagrams/Structure_BayesInf.drawio
 create mode 100644 src/bayesvalidrox/surrogate_models/sequential_design.py

diff --git a/docs/diagrams/.$Structure_BayesInf.drawio.bkp b/docs/diagrams/.$Structure_BayesInf.drawio.bkp
new file mode 100644
index 000000000..2e28cbcb3
--- /dev/null
+++ b/docs/diagrams/.$Structure_BayesInf.drawio.bkp
@@ -0,0 +1,964 @@
+<mxfile host="Electron" modified="2024-04-19T16:08:43.773Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.1.11 Chrome/114.0.5735.289 Electron/25.9.8 Safari/537.36" etag="2ELAo-FvqOEnLxZhqqO4" version="22.1.11" type="device" pages="4">
+  <diagram name="Class and function structure" id="efOe0Jku58RX-i1bv-3b">
+    <mxGraphModel dx="3735" dy="1372" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-22" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;MCMC&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1270" y="360" width="770" height="380" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-1" value="_kernel_rbf" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1020" y="200" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-2" value="_logpdf" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="820" y="140" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-10" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;BayesInf&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-120" y="290" width="1310" height="680" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-24" value="if self.bootstrap &lt;br&gt;or self.bayes_loocv &lt;br&gt;or self.just_analysis" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;labelBackgroundColor=#ffae00;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-13">
+          <mxGeometry x="0.2902" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-18">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-42" value="if self.name != &#39;valid&#39;&lt;br&gt;and self.inference_method != &#39;rejection&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=default;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-31">
+          <mxGeometry x="0.5646" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="HiMKSJFquRK0mIlwyRFI-5">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-43" value="if self.inference_method == &#39;mcmc&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-32">
+          <mxGeometry x="-0.0958" y="-1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-19">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-52" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#C2C2C2;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-33">
+          <mxGeometry x="-0.112" y="1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-21">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-47" value="if self.plot_post_pred" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-34">
+          <mxGeometry x="0.2399" y="-1" relative="1" as="geometry">
+            <mxPoint y="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-20">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-46" value="if self.plot_map_pred" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-35">
+          <mxGeometry x="0.4183" y="-1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-55" value="if self.bootstrap" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-54">
+          <mxGeometry x="0.1816" y="3" relative="1" as="geometry">
+            <mxPoint x="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-56">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-58" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-57">
+          <mxGeometry x="0.7182" y="2" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-60" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-59">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-61" value="if self.error_model&lt;br&gt;and self.name == &#39;calib&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-60">
+          <mxGeometry x="0.3024" y="2" relative="1" as="geometry">
+            <mxPoint x="67" y="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="HiMKSJFquRK0mIlwyRFI-51">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-55" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-54">
+          <mxGeometry x="0.8253" y="3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-9" value="create_inference" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="405" y="539" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-25" value="if len(self.perturbed_data) == 0" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-14">
+          <mxGeometry x="0.3402" relative="1" as="geometry">
+            <mxPoint y="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-27" value="if not self.emulator" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-15">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-16">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-44" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#cdcbcb;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-29">
+          <mxGeometry x="0.4722" y="1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-17">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-41" value="if self.emulator" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-30">
+          <mxGeometry x="0.6143" y="-3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-62" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-59">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="340" y="680" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-63" value="if self.error_model&lt;br&gt;and self.name == &#39;valid&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=default;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-62">
+          <mxGeometry x="-0.3906" relative="1" as="geometry">
+            <mxPoint y="121" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-13" value="perform_bootstrap" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="50" y="335" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-14" value="_perturb_data" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-75" y="460" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-15" value="_eval_model" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1050" y="660" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-16" target="xary-zVek9Bg-A1b1ZmA-1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-49" value="if hasattr bias_inputs&amp;nbsp;&lt;br&gt;and not hasattr error_model" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#ffae00;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-38">
+          <mxGeometry x="0.3126" y="-3" relative="1" as="geometry">
+            <mxPoint x="-103" y="31" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-16" target="xary-zVek9Bg-A1b1ZmA-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-16" value="normpdf" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="650" y="455" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-17" target="xary-zVek9Bg-A1b1ZmA-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-50" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#cdcbcb;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-40">
+          <mxGeometry x="-0.6073" y="-5" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-17" value="_corr_factor_BME" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="650" y="385" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-18" value="_rejection_sampling" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="280" y="890" width="120" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-26" value="if not self.emulator&amp;nbsp;&lt;br&gt;and not self.inference_method == &#39;rejection&#39;&amp;nbsp;&lt;br&gt;and self.name == &#39;calib" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-19" target="xary-zVek9Bg-A1b1ZmA-15">
+          <mxGeometry x="-0.0559" y="15" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-19" target="xary-zVek9Bg-A1b1ZmA-1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-48" value="if sigma2_prior is not None&lt;br&gt;and if hasattr bias_inputs&lt;br&gt;and if not hasattr error_model" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#ffae00;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-37">
+          <mxGeometry x="-0.5544" y="-1" relative="1" as="geometry">
+            <mxPoint x="1" y="-5" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-19" value="_posterior_predictive" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="690" y="589" width="130" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="xary-zVek9Bg-A1b1ZmA-20" target="xary-zVek9Bg-A1b1ZmA-15">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-45" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#cdcbcb;" vertex="1" connectable="0" parent="xary-zVek9Bg-A1b1ZmA-28">
+          <mxGeometry x="0.0517" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-20" value="_plot_max_a_posteriori" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="495" y="790" width="140" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-21" value="plot_post_predictive" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="630" y="720" width="120" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-36" value="Note: Arrows indicate function calls, beginning calls the end" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
+          <mxGeometry x="10" y="10" width="190" height="30" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-51" value="Color meanings:&lt;br&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;red: wrong, change&lt;br&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;orange: seems off, look at again&lt;br&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;light beige: has been removed" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
+          <mxGeometry x="20" y="70" width="220" height="30" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-53" value="plot_log_BME" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="150" y="820" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-56" value="plot_post_params" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="660" y="840" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-59" value="create_error_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="45" y="740" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-1" value="_check_ranges" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1595" y="280" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-2" value="gelman_rubin" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1350" y="250" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-3" value="_iterative_scheme" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" vertex="1" parent="1">
+          <mxGeometry x="2055" y="620" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-4" target="HiMKSJFquRK0mIlwyRFI-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-4" target="HiMKSJFquRK0mIlwyRFI-11">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-4" value="_my_ESS" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" vertex="1" parent="1">
+          <mxGeometry x="1350" y="100" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-8">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-10">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-53" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-52">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-56" value="if opts_sigma != &#39;B&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-53">
+          <mxGeometry x="0.7377" y="1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-5" value="run_sampler" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="1350" y="534" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-6" target="HiMKSJFquRK0mIlwyRFI-1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-6" value="log_prior" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1595" y="510" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-7" target="HiMKSJFquRK0mIlwyRFI-9">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-16" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-15">
+          <mxGeometry x="0.0246" y="2" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-7" value="log_likelihood" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1760" y="539" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-8" target="HiMKSJFquRK0mIlwyRFI-6">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-17" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-12">
+          <mxGeometry x="0.4587" y="4" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-8" target="HiMKSJFquRK0mIlwyRFI-7">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-18" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-13">
+          <mxGeometry x="0.6826" y="4" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-8" value="log_posterior" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1480" y="610" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-9" value="eval_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1760" y="400" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-10" value="train_error_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="1450" y="420" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-11" target="HiMKSJFquRK0mIlwyRFI-3">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-11" value="marginal_llk_emcee" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" vertex="1" parent="1">
+          <mxGeometry x="1870" y="620" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-25" value="Never used!" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontColor=#CCC1AA;" vertex="1" parent="1">
+          <mxGeometry x="1880" y="680" width="100" height="30" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-26" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;BayesModelComp&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-1096" y="380" width="840" height="420" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-27" target="HC1H8j6nMwEtLoyIrXXk-3">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-27" target="HC1H8j6nMwEtLoyIrXXk-1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-27" target="HiMKSJFquRK0mIlwyRFI-31">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-27" value="model_comparison_all" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="-896" y="566" width="160" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="xary-zVek9Bg-A1b1ZmA-9">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="-630" y="564" as="sourcePoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-47" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-42">
+          <mxGeometry x="-0.4883" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-29" target="HiMKSJFquRK0mIlwyRFI-30">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-49" value="if perturbed_data is None" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="HiMKSJFquRK0mIlwyRFI-37">
+          <mxGeometry x="-0.0507" y="4" relative="1" as="geometry">
+            <mxPoint x="-1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-29" value="generate_dataset" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-546" y="566" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-30" value="_perturb_data" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-376" y="636" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-31" target="HC1H8j6nMwEtLoyIrXXk-1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-31" target="HiMKSJFquRK0mIlwyRFI-33">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HiMKSJFquRK0mIlwyRFI-31" target="HC1H8j6nMwEtLoyIrXXk-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-31" value="cal_model_weight" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="-871" y="466" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-32" value="plot_just_analysis" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-871" y="736" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-33" value="plot_model_weights" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-1016" y="416" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-34" value="plot_bayes_factor" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-446" y="431" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-51" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;Discrepancy&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="360" y="1039.82" width="200" height="130" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-52" value="get_sample" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="400" y="1079.82" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="HiMKSJFquRK0mIlwyRFI-34">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="HC1H8j6nMwEtLoyIrXXk-17">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="HiMKSJFquRK0mIlwyRFI-29">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-1" value="calc_bayes_factors" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="-666" y="466" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-2" value="calc_model_weights" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-1066" y="566" width="130" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HiMKSJFquRK0mIlwyRFI-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HC1H8j6nMwEtLoyIrXXk-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="xary-zVek9Bg-A1b1ZmA-9">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-23" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="HC1H8j6nMwEtLoyIrXXk-16">
+          <mxGeometry x="-0.5478" y="3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HC1H8j6nMwEtLoyIrXXk-17">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HiMKSJFquRK0mIlwyRFI-29">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-3" value="calc_justifiability_analysis" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="-896" y="666" width="160" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-17" value="setup" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="-666" y="566" width="110" height="50" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+  <diagram id="sQf09xvhinkT827TE7Va" name="Function structure Engine">
+    <mxGraphModel dx="1436" dy="968" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-1" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;Engine&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="130" y="140" width="1390" height="690" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-2" value="hellinger_distance" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1340" y="50" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-3" value="logpdf" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1050" y="50" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-4" value="subdomain" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="625" y="50" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-5" value="start_engine" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="250" y="680" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-6" target="JXjM7l_erEiZMkSmYBvl-5">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-6" value="train_normal" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="170" y="420" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-7" target="JXjM7l_erEiZMkSmYBvl-9">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="335" y="335" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-7" target="JXjM7l_erEiZMkSmYBvl-6">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-7" value="train_sequential" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="170" y="310" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-8" value="eval_metamodel" style="html=1;whiteSpace=wrap;strokeWidth=2;" vertex="1" parent="1">
+          <mxGeometry x="190" y="210" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-18">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-23">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-20" value="if len(obs_data) != 0" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-19">
+          <mxGeometry x="0.8137" relative="1" as="geometry">
+            <mxPoint x="-57" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-24">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-22" value="if len(obs_data) != 0" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-21">
+          <mxGeometry x="0.7684" y="3" relative="1" as="geometry">
+            <mxPoint x="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-25">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-24" value="if expdes.valid_model_runs" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-23">
+          <mxGeometry x="0.606" y="3" relative="1" as="geometry">
+            <mxPoint x="-16" y="3" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-26">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-26" value="if mc_ref and pce" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-25">
+          <mxGeometry x="0.7094" y="-3" relative="1" as="geometry">
+            <mxPoint x="-31" y="-3" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-9" value="train_seq_design" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="315" y="310" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-12" value="util_VarBasedDesign" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="670" y="648" width="130" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-13" target="JXjM7l_erEiZMkSmYBvl-3">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-13" target="JXjM7l_erEiZMkSmYBvl-5">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-15" target="JXjM7l_erEiZMkSmYBvl-13">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-39" value="if method == &#39;bayesactdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=default;" vertex="1" connectable="0" parent="JXjM7l_erEiZMkSmYBvl-38">
+          <mxGeometry x="-0.6235" y="2" relative="1" as="geometry">
+            <mxPoint x="289" y="2" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-13" target="JXjM7l_erEiZMkSmYBvl-21">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-15" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-12">
+          <mxGeometry x="0.7865" y="4" relative="1" as="geometry">
+            <mxPoint x="-91" y="185" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-13" value="util_BayesianActiveDesign" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1020" y="680" width="150" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-14" target="JXjM7l_erEiZMkSmYBvl-6">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-14" target="JXjM7l_erEiZMkSmYBvl-21">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-16" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-13">
+          <mxGeometry x="0.197" y="-3" relative="1" as="geometry">
+            <mxPoint x="-1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-14" value="utilBayesianDesign" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="880" y="730" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-15" target="JXjM7l_erEiZMkSmYBvl-12">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-15" target="JXjM7l_erEiZMkSmYBvl-14">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-43" value="if method == &#39;bayesoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="JXjM7l_erEiZMkSmYBvl-42">
+          <mxGeometry x="0.6143" y="-3" relative="1" as="geometry">
+            <mxPoint x="3" y="29" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-15" value="run_util_func" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="660" y="450" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-16" target="JXjM7l_erEiZMkSmYBvl-12">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-41" value="if method == &#39;varoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="JXjM7l_erEiZMkSmYBvl-36">
+          <mxGeometry x="-0.5992" relative="1" as="geometry">
+            <mxPoint x="-197" y="62" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-16" target="JXjM7l_erEiZMkSmYBvl-13">
+          <mxGeometry relative="1" as="geometry">
+            <Array as="points">
+              <mxPoint x="965" y="590" />
+              <mxPoint x="1095" y="590" />
+            </Array>
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-16" target="JXjM7l_erEiZMkSmYBvl-14">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-16" value="dual_annealing" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="910" y="450" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-17" target="JXjM7l_erEiZMkSmYBvl-18">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-6" value="if exploit _method is &#39;bayesoptdesign&#39;,&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&#39;bayesactdesign&#39; or &#39;varoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-5">
+          <mxGeometry x="0.1312" y="2" relative="1" as="geometry">
+            <mxPoint x="17" y="-2" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-17" value="tradeoff_weights" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="980" y="210" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-4">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-15">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="790" y="280.0000000000002" as="sourcePoint" />
+            <mxPoint x="690" y="499.9999999999998" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-2" value="if exploit _method is &#39;bayesoptdesign&#39;,&lt;br&gt;&#39;bayesactdesign&#39; or &#39;varoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-1">
+          <mxGeometry x="0.1579" relative="1" as="geometry">
+            <mxPoint x="-15" y="49" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-16">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="680" y="205.05882352941194" as="sourcePoint" />
+            <mxPoint x="805" y="779.9999999999998" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-4" value="if explore_method == &#39;dual annealing&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-3">
+          <mxGeometry x="-0.6061" relative="1" as="geometry">
+            <mxPoint x="270" y="46" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-20">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-10" value="if exploit_method == &#39;alphabetic&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-9">
+          <mxGeometry x="0.8144" y="1" relative="1" as="geometry">
+            <mxPoint x="74" y="-1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-18" value="choose_next_sample" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="610" y="210" width="140" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-20" value="util_AlphOptDesign" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="330" y="210" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-21" value="_normpdf" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1340" y="430" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-22" target="JXjM7l_erEiZMkSmYBvl-3">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-22" value="_corr_factor_BME" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1130" y="220" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-23" value="_posteriorPlot" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="520" y="440" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-24" target="JXjM7l_erEiZMkSmYBvl-2">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-24" target="JXjM7l_erEiZMkSmYBvl-21">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-14" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-11">
+          <mxGeometry x="0.0929" y="-1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="JXjM7l_erEiZMkSmYBvl-24" target="JXjM7l_erEiZMkSmYBvl-22">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-18" value="commented out?" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="W5_FOelZ0qj-h3Gb0n3K-17">
+          <mxGeometry x="-0.1477" y="3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-24" value="_BME_Calculator" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="1340" y="220" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-25" value="_validError" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="520" y="510" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-26" value="_error_Mean_Std" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="520" y="580" width="110" height="50" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+  <diagram id="ME5gyYpVqUByTnAIOcMV" name="Parameter and function interaction">
+    <mxGraphModel dx="2049" dy="1366" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-1" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-1" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-1" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-1" value="engine" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="160" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-3" value="Discrepancy" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="240" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-71" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-4" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-4" value="emulator" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="320" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-5" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-5" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-5" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-5" value="name" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="400" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-47" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-6" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-6" value="bootstrap" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="480" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-7" value="req_outputs" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="560" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-79" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-8" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-8" value="selected_indices" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="640" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-9" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-9" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-67" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-9" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-9" value="prior_samples" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="720" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-11" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-68" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-11" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-11" value="n_prior_samples" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="800" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-12" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-80" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-12" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-12" value="measured_data" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="880" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-58" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-13" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-13" value="inference_method" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="960" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-14" value="mcmc_params" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1040" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-63" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-15" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-15" value="perturbed_data" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1120" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-16" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-77" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-16" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-16" value="bayes_loocv" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1200" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-64" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-17" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-17" value="n_bootstrap_itrs" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1280" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-18" value="bootstrap_noise" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1360" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-19" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-78" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-19" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-19" value="just_analysis" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1440" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-20" value="valid_metrics" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1520" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-52" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-21" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-21" value="plot_post_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1600" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-51" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-22" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-22" value="plot_map_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1680" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-23" value="max_a_posteriori" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1760" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-24" value="corner_title_fmt" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1840" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-25" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-25" value="out_dir" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1920" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-26" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-26" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-26" value="error_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2000" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-56" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-27" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-72" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-27" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-27" value="bias_inputs" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2080" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-41" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-28" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-28" value="measurement_error" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2160" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-29" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-81" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-29" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-29" value="sigma2s" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2240" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-30" value="log_likes" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2320" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-82" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-31" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-31" value="dtype" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2400" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-32" value="create_inference" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="400" y="20" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-39" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-39" value="n_tot_measurement" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2480" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-42" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-42" value="Discrepancy" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2560" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-48" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-59" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-48" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-48" value="posterior_df" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2640" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-53" value="create_error_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="560" y="20" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-60" value="perform_bootstrap" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="720" y="20" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-75" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-69" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-69" value="__mean_pce_prior_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2720" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-76" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-70" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-70" value="_std_pce_prior_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2800" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-74" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-73" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-73" value="__model_prior_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2880" width="120" height="60" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+  <diagram id="QgiNX2WXFOBDsDgzoFY9" name="Folder structure">
+    <mxGraphModel dx="1436" dy="968" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="KLYezTmecfuvBG8KQe-n-1" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="140" y="80" width="750" height="550" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-2" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="170" y="110" width="700" height="220" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-3" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="170" y="370" width="180" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-4" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="170" y="440" width="180" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-5" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="170" y="500" width="180" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-6" value="adaptPlot" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="190" y="150" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-7" value="apoly_construction" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="280" y="150" width="140" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-8" value="bayes_linear" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="440" y="150" width="90" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-9" value="engine" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="550" y="150" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-11" value="eval_rec_rule" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="640" y="150" width="100" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-12" value="exp_designs" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="760" y="150" width="90" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-13" value="exploration" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="190" y="210" width="80" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-14" value="glexindex" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="290" y="210" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-15" value="input_space" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="380" y="210" width="80" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-16" value="inputs" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="480" y="210" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-17" value="meta_model_engine" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" vertex="1" parent="1">
+          <mxGeometry x="570" y="210" width="160" height="50" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+</mxfile>
diff --git a/docs/diagrams/Structure_BayesInf.drawio b/docs/diagrams/Structure_BayesInf.drawio
new file mode 100644
index 000000000..d71ef7225
--- /dev/null
+++ b/docs/diagrams/Structure_BayesInf.drawio
@@ -0,0 +1,964 @@
+<mxfile host="Electron" modified="2024-04-24T13:20:35.182Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.1.11 Chrome/114.0.5735.289 Electron/25.9.8 Safari/537.36" etag="yF3UWZAVG7IacsJBd-44" version="22.1.11" type="device" pages="4">
+  <diagram name="Class and function structure" id="efOe0Jku58RX-i1bv-3b">
+    <mxGraphModel dx="2921" dy="823" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-22" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;MCMC&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="1270" y="360" width="770" height="380" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-1" value="_kernel_rbf" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1020" y="200" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-2" value="_logpdf" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="820" y="140" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-10" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;BayesInf&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-120" y="290" width="1310" height="680" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-24" value="if self.bootstrap &lt;br&gt;or self.bayes_loocv &lt;br&gt;or self.just_analysis" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;labelBackgroundColor=#ffae00;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-13" edge="1">
+          <mxGeometry x="0.2902" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-18" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-42" value="if self.name != &#39;valid&#39;&lt;br&gt;and self.inference_method != &#39;rejection&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=default;" parent="xary-zVek9Bg-A1b1ZmA-31" vertex="1" connectable="0">
+          <mxGeometry x="0.5646" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="HiMKSJFquRK0mIlwyRFI-5" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-43" value="if self.inference_method == &#39;mcmc&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="xary-zVek9Bg-A1b1ZmA-32" vertex="1" connectable="0">
+          <mxGeometry x="-0.0958" y="-1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-19" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-52" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#C2C2C2;" parent="xary-zVek9Bg-A1b1ZmA-33" vertex="1" connectable="0">
+          <mxGeometry x="-0.112" y="1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-21" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-47" value="if self.plot_post_pred" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="xary-zVek9Bg-A1b1ZmA-34" vertex="1" connectable="0">
+          <mxGeometry x="0.2399" y="-1" relative="1" as="geometry">
+            <mxPoint y="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-20" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-46" value="if self.plot_map_pred" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="xary-zVek9Bg-A1b1ZmA-35" vertex="1" connectable="0">
+          <mxGeometry x="0.4183" y="-1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-53" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-55" value="if self.bootstrap" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" parent="xary-zVek9Bg-A1b1ZmA-54" vertex="1" connectable="0">
+          <mxGeometry x="0.1816" y="3" relative="1" as="geometry">
+            <mxPoint x="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-56" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-58" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" parent="xary-zVek9Bg-A1b1ZmA-57" vertex="1" connectable="0">
+          <mxGeometry x="0.7182" y="2" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-60" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="xary-zVek9Bg-A1b1ZmA-59" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-61" value="if self.error_model&lt;br&gt;and self.name == &#39;calib&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="xary-zVek9Bg-A1b1ZmA-60" vertex="1" connectable="0">
+          <mxGeometry x="0.3024" y="2" relative="1" as="geometry">
+            <mxPoint x="67" y="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-9" target="HiMKSJFquRK0mIlwyRFI-51" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-55" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" parent="HiMKSJFquRK0mIlwyRFI-54" vertex="1" connectable="0">
+          <mxGeometry x="0.8253" y="3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-9" value="create_inference" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="405" y="539" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-25" value="if len(self.perturbed_data) == 0" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-14" edge="1">
+          <mxGeometry x="0.3402" relative="1" as="geometry">
+            <mxPoint y="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-27" value="if not self.emulator" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-15" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-16" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-44" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#cdcbcb;" parent="xary-zVek9Bg-A1b1ZmA-29" vertex="1" connectable="0">
+          <mxGeometry x="0.4722" y="1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-17" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-41" value="if self.emulator" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="xary-zVek9Bg-A1b1ZmA-30" vertex="1" connectable="0">
+          <mxGeometry x="0.6143" y="-3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-62" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="xary-zVek9Bg-A1b1ZmA-13" target="xary-zVek9Bg-A1b1ZmA-59" edge="1">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="340" y="680" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-63" value="if self.error_model&lt;br&gt;and self.name == &#39;valid&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=default;" parent="xary-zVek9Bg-A1b1ZmA-62" vertex="1" connectable="0">
+          <mxGeometry x="-0.3906" relative="1" as="geometry">
+            <mxPoint y="121" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-13" value="perform_bootstrap" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="50" y="335" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-14" value="_perturb_data" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-75" y="460" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-15" value="_eval_model" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="1050" y="660" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-16" target="xary-zVek9Bg-A1b1ZmA-1" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-49" value="if hasattr bias_inputs&amp;nbsp;&lt;br&gt;and not hasattr error_model" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#ffae00;" parent="xary-zVek9Bg-A1b1ZmA-38" vertex="1" connectable="0">
+          <mxGeometry x="0.3126" y="-3" relative="1" as="geometry">
+            <mxPoint x="-103" y="31" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-39" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-16" target="xary-zVek9Bg-A1b1ZmA-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-16" value="normpdf" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="650" y="455" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-17" target="xary-zVek9Bg-A1b1ZmA-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-50" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#cdcbcb;" parent="xary-zVek9Bg-A1b1ZmA-40" vertex="1" connectable="0">
+          <mxGeometry x="-0.6073" y="-5" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-17" value="_corr_factor_BME" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="650" y="385" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-18" value="_rejection_sampling" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="280" y="890" width="120" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-26" value="if not self.emulator&amp;nbsp;&lt;br&gt;and not self.inference_method == &#39;rejection&#39;&amp;nbsp;&lt;br&gt;and self.name == &#39;calib" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-19" target="xary-zVek9Bg-A1b1ZmA-15" edge="1">
+          <mxGeometry x="-0.0559" y="15" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-19" target="xary-zVek9Bg-A1b1ZmA-1" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-48" value="if sigma2_prior is not None&lt;br&gt;and if hasattr bias_inputs&lt;br&gt;and if not hasattr error_model" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#ffae00;" parent="xary-zVek9Bg-A1b1ZmA-37" vertex="1" connectable="0">
+          <mxGeometry x="-0.5544" y="-1" relative="1" as="geometry">
+            <mxPoint x="1" y="-5" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-19" value="_posterior_predictive" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="690" y="589" width="130" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="xary-zVek9Bg-A1b1ZmA-20" target="xary-zVek9Bg-A1b1ZmA-15" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-45" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#cdcbcb;" parent="xary-zVek9Bg-A1b1ZmA-28" vertex="1" connectable="0">
+          <mxGeometry x="0.0517" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-20" value="_plot_max_a_posteriori" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="495" y="790" width="140" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-21" value="plot_post_predictive" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="630" y="720" width="120" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-36" value="Note: Arrows indicate function calls, beginning calls the end" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
+          <mxGeometry x="10" y="10" width="190" height="30" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-51" value="Color meanings:&lt;br&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;red: wrong, change&lt;br&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;orange: seems off, look at again&lt;br&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&#x9;&lt;/span&gt;light beige: has been removed" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
+          <mxGeometry x="20" y="70" width="220" height="30" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-53" value="plot_log_BME" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="150" y="820" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-56" value="plot_post_params" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="660" y="840" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="xary-zVek9Bg-A1b1ZmA-59" value="create_error_model" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="45" y="740" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-1" value="_check_ranges" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1595" y="280" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-2" value="gelman_rubin" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1350" y="250" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-3" value="_iterative_scheme" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" parent="1" vertex="1">
+          <mxGeometry x="2055" y="620" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" parent="1" source="HiMKSJFquRK0mIlwyRFI-4" target="HiMKSJFquRK0mIlwyRFI-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" parent="1" source="HiMKSJFquRK0mIlwyRFI-4" target="HiMKSJFquRK0mIlwyRFI-11" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-4" value="_my_ESS" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" parent="1" vertex="1">
+          <mxGeometry x="1350" y="100" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-8" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-10" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-53" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-5" target="HiMKSJFquRK0mIlwyRFI-52" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-56" value="if opts_sigma != &#39;B&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#FF9A03;" parent="HiMKSJFquRK0mIlwyRFI-53" vertex="1" connectable="0">
+          <mxGeometry x="0.7377" y="1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-5" value="run_sampler" style="rounded=0;whiteSpace=wrap;html=1;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="1350" y="534" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-6" target="HiMKSJFquRK0mIlwyRFI-1" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-6" value="log_prior" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1595" y="510" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-15" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-7" target="HiMKSJFquRK0mIlwyRFI-9" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-16" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="HiMKSJFquRK0mIlwyRFI-15" vertex="1" connectable="0">
+          <mxGeometry x="0.0246" y="2" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-7" value="log_likelihood" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1760" y="539" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-8" target="HiMKSJFquRK0mIlwyRFI-6" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-17" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="HiMKSJFquRK0mIlwyRFI-12" vertex="1" connectable="0">
+          <mxGeometry x="0.4587" y="4" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-8" target="HiMKSJFquRK0mIlwyRFI-7" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-18" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="HiMKSJFquRK0mIlwyRFI-13" vertex="1" connectable="0">
+          <mxGeometry x="0.6826" y="4" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-8" value="log_posterior" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1480" y="610" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-9" value="eval_model" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1760" y="400" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-10" value="train_error_model" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="1450" y="420" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" parent="1" source="HiMKSJFquRK0mIlwyRFI-11" target="HiMKSJFquRK0mIlwyRFI-3" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-11" value="marginal_llk_emcee" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f9f7ed;strokeColor=#CCC1AA;fontColor=#CCC1AA;" parent="1" vertex="1">
+          <mxGeometry x="1870" y="620" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-25" value="Never used!" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontColor=#CCC1AA;" parent="1" vertex="1">
+          <mxGeometry x="1880" y="680" width="100" height="30" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-26" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;BayesModelComp&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-1096" y="380" width="840" height="420" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-27" target="HC1H8j6nMwEtLoyIrXXk-3" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-27" target="HC1H8j6nMwEtLoyIrXXk-1" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-27" target="HiMKSJFquRK0mIlwyRFI-31" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-27" value="model_comparison_all" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="-896" y="566" width="160" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="xary-zVek9Bg-A1b1ZmA-9" edge="1">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="-630" y="564" as="sourcePoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-47" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="HiMKSJFquRK0mIlwyRFI-42" vertex="1" connectable="0">
+          <mxGeometry x="-0.4883" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="HiMKSJFquRK0mIlwyRFI-29" target="HiMKSJFquRK0mIlwyRFI-30" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-49" value="if perturbed_data is None" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="HiMKSJFquRK0mIlwyRFI-37" vertex="1" connectable="0">
+          <mxGeometry x="-0.0507" y="4" relative="1" as="geometry">
+            <mxPoint x="-1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-29" value="generate_dataset" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-546" y="566" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-30" value="_perturb_data" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-376" y="636" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-31" target="HC1H8j6nMwEtLoyIrXXk-1" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-31" target="HiMKSJFquRK0mIlwyRFI-33" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HiMKSJFquRK0mIlwyRFI-31" target="HC1H8j6nMwEtLoyIrXXk-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-31" value="cal_model_weight" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="-871" y="466" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-32" value="plot_just_analysis" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-871" y="736" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-33" value="plot_model_weights" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-1016" y="416" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-34" value="plot_bayes_factor" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-446" y="431" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-51" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;Discrepancy&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="360" y="1039.82" width="200" height="130" as="geometry" />
+        </mxCell>
+        <mxCell id="HiMKSJFquRK0mIlwyRFI-52" value="get_sample" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+          <mxGeometry x="400" y="1079.82" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="HiMKSJFquRK0mIlwyRFI-34" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="HC1H8j6nMwEtLoyIrXXk-17" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-1" target="HiMKSJFquRK0mIlwyRFI-29" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-1" value="calc_bayes_factors" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="-666" y="466" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-2" value="calc_model_weights" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-1066" y="566" width="130" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HiMKSJFquRK0mIlwyRFI-32" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HC1H8j6nMwEtLoyIrXXk-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="xary-zVek9Bg-A1b1ZmA-9" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-23" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="HC1H8j6nMwEtLoyIrXXk-16" vertex="1" connectable="0">
+          <mxGeometry x="-0.5478" y="3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HC1H8j6nMwEtLoyIrXXk-17" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-22" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="HC1H8j6nMwEtLoyIrXXk-3" target="HiMKSJFquRK0mIlwyRFI-29" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-3" value="calc_justifiability_analysis" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="-896" y="666" width="160" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="HC1H8j6nMwEtLoyIrXXk-17" value="setup" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="-666" y="566" width="110" height="50" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+  <diagram id="sQf09xvhinkT827TE7Va" name="Function structure Engine">
+    <mxGraphModel dx="1357" dy="914" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-1" value="&lt;p style=&quot;margin:0px;margin-top:4px;text-align:center;&quot;&gt;&lt;b&gt;Engine&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;&gt;&lt;div style=&quot;height:2px;&quot;&gt;&lt;/div&gt;" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="130" y="140" width="1390" height="690" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-2" value="hellinger_distance" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="1340" y="50" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-3" value="logpdf" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="1050" y="50" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-4" value="subdomain" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="625" y="50" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-5" value="start_engine" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="250" y="680" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-6" target="JXjM7l_erEiZMkSmYBvl-5" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-6" value="train_normal" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="170" y="420" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-7" target="JXjM7l_erEiZMkSmYBvl-9" edge="1">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="335" y="335" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-7" target="JXjM7l_erEiZMkSmYBvl-6" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-7" value="train_sequential" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="170" y="310" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-8" value="eval_metamodel" style="html=1;whiteSpace=wrap;strokeWidth=2;" parent="1" vertex="1">
+          <mxGeometry x="190" y="210" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-18" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-23" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-20" value="if len(obs_data) != 0" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-19" vertex="1" connectable="0">
+          <mxGeometry x="0.8137" relative="1" as="geometry">
+            <mxPoint x="-57" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-24" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-22" value="if len(obs_data) != 0" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-21" vertex="1" connectable="0">
+          <mxGeometry x="0.7684" y="3" relative="1" as="geometry">
+            <mxPoint x="1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-25" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-24" value="if expdes.valid_model_runs" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-23" vertex="1" connectable="0">
+          <mxGeometry x="0.606" y="3" relative="1" as="geometry">
+            <mxPoint x="-16" y="3" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-9" target="JXjM7l_erEiZMkSmYBvl-26" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-26" value="if mc_ref and pce" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-25" vertex="1" connectable="0">
+          <mxGeometry x="0.7094" y="-3" relative="1" as="geometry">
+            <mxPoint x="-31" y="-3" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-9" value="train_seq_design" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="315" y="310" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-12" value="util_VarBasedDesign" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="670" y="648" width="130" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-13" target="JXjM7l_erEiZMkSmYBvl-3" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JXjM7l_erEiZMkSmYBvl-13" target="JXjM7l_erEiZMkSmYBvl-5" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-15" target="JXjM7l_erEiZMkSmYBvl-13" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-39" value="if method == &#39;bayesactdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=default;" parent="JXjM7l_erEiZMkSmYBvl-38" vertex="1" connectable="0">
+          <mxGeometry x="-0.6235" y="2" relative="1" as="geometry">
+            <mxPoint x="289" y="2" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-13" target="JXjM7l_erEiZMkSmYBvl-21" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-15" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-12" vertex="1" connectable="0">
+          <mxGeometry x="0.7865" y="4" relative="1" as="geometry">
+            <mxPoint x="-91" y="185" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-13" value="util_BayesianActiveDesign" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="1020" y="680" width="150" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-14" target="JXjM7l_erEiZMkSmYBvl-6" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-14" target="JXjM7l_erEiZMkSmYBvl-21" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-16" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-13" vertex="1" connectable="0">
+          <mxGeometry x="0.197" y="-3" relative="1" as="geometry">
+            <mxPoint x="-1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-14" value="utilBayesianDesign" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="880" y="730" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-15" target="JXjM7l_erEiZMkSmYBvl-12" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-15" target="JXjM7l_erEiZMkSmYBvl-14" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-43" value="if method == &#39;bayesoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JXjM7l_erEiZMkSmYBvl-42" vertex="1" connectable="0">
+          <mxGeometry x="0.6143" y="-3" relative="1" as="geometry">
+            <mxPoint x="3" y="29" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-15" value="run_util_func" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="660" y="450" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-16" target="JXjM7l_erEiZMkSmYBvl-12" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-41" value="if method == &#39;varoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="JXjM7l_erEiZMkSmYBvl-36" vertex="1" connectable="0">
+          <mxGeometry x="-0.5992" relative="1" as="geometry">
+            <mxPoint x="-197" y="62" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JXjM7l_erEiZMkSmYBvl-16" target="JXjM7l_erEiZMkSmYBvl-13" edge="1">
+          <mxGeometry relative="1" as="geometry">
+            <Array as="points">
+              <mxPoint x="965" y="590" />
+              <mxPoint x="1095" y="590" />
+            </Array>
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JXjM7l_erEiZMkSmYBvl-16" target="JXjM7l_erEiZMkSmYBvl-14" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-16" value="dual_annealing" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="910" y="450" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-17" target="JXjM7l_erEiZMkSmYBvl-18" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-6" value="if exploit _method is &#39;bayesoptdesign&#39;,&lt;br style=&quot;border-color: var(--border-color);&quot;&gt;&#39;bayesactdesign&#39; or &#39;varoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-5" vertex="1" connectable="0">
+          <mxGeometry x="0.1312" y="2" relative="1" as="geometry">
+            <mxPoint x="17" y="-2" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-17" value="tradeoff_weights" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="980" y="210" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-4" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-15" edge="1">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="790" y="280.0000000000002" as="sourcePoint" />
+            <mxPoint x="690" y="499.9999999999998" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-2" value="if exploit _method is &#39;bayesoptdesign&#39;,&lt;br&gt;&#39;bayesactdesign&#39; or &#39;varoptdesign&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-1" vertex="1" connectable="0">
+          <mxGeometry x="0.1579" relative="1" as="geometry">
+            <mxPoint x="-15" y="49" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-16" edge="1">
+          <mxGeometry relative="1" as="geometry">
+            <mxPoint x="680" y="205.05882352941194" as="sourcePoint" />
+            <mxPoint x="805" y="779.9999999999998" as="targetPoint" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-4" value="if explore_method == &#39;dual annealing&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-3" vertex="1" connectable="0">
+          <mxGeometry x="-0.6061" relative="1" as="geometry">
+            <mxPoint x="270" y="46" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JXjM7l_erEiZMkSmYBvl-18" target="JXjM7l_erEiZMkSmYBvl-20" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-10" value="if exploit_method == &#39;alphabetic&#39;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-9" vertex="1" connectable="0">
+          <mxGeometry x="0.8144" y="1" relative="1" as="geometry">
+            <mxPoint x="74" y="-1" as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-18" value="choose_next_sample" style="html=1;whiteSpace=wrap;fillColor=#fad7ac;strokeColor=#b46504;" parent="1" vertex="1">
+          <mxGeometry x="610" y="210" width="140" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-20" value="util_AlphOptDesign" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="330" y="210" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-21" value="_normpdf" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="1340" y="430" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="JXjM7l_erEiZMkSmYBvl-22" target="JXjM7l_erEiZMkSmYBvl-3" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-22" value="_corr_factor_BME" style="html=1;whiteSpace=wrap;strokeColor=#CC6600;" parent="1" vertex="1">
+          <mxGeometry x="1130" y="220" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-23" value="_posteriorPlot" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="520" y="440" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-24" target="JXjM7l_erEiZMkSmYBvl-2" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-24" target="JXjM7l_erEiZMkSmYBvl-21" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-14" value="always" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-11" vertex="1" connectable="0">
+          <mxGeometry x="0.0929" y="-1" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="JXjM7l_erEiZMkSmYBvl-24" target="JXjM7l_erEiZMkSmYBvl-22" edge="1">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="W5_FOelZ0qj-h3Gb0n3K-18" value="commented out?" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="W5_FOelZ0qj-h3Gb0n3K-17" vertex="1" connectable="0">
+          <mxGeometry x="-0.1477" y="3" relative="1" as="geometry">
+            <mxPoint as="offset" />
+          </mxGeometry>
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-24" value="_BME_Calculator" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="1340" y="220" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-25" value="_validError" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="520" y="510" width="110" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="JXjM7l_erEiZMkSmYBvl-26" value="_error_Mean_Std" style="html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="520" y="580" width="110" height="50" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+  <diagram id="ME5gyYpVqUByTnAIOcMV" name="Parameter and function interaction">
+    <mxGraphModel dx="2049" dy="1366" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-33" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-1" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-54" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-1" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-1" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-1" value="engine" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="160" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-3" value="Discrepancy" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="240" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-71" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-4" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-4" value="emulator" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="320" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-37" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-5" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-5" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-5" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-5" value="name" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="400" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-47" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-6" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-6" value="bootstrap" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="480" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-7" value="req_outputs" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="560" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-79" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-8" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-8" value="selected_indices" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="640" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-9" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-9" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-67" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-9" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-9" value="prior_samples" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="720" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-11" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-68" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-11" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-11" value="n_prior_samples" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="800" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-12" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-80" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-12" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-12" value="measured_data" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="880" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-58" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-13" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-13" value="inference_method" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="960" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-14" value="mcmc_params" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1040" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-63" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-15" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-15" value="perturbed_data" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1120" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-16" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-77" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-16" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-16" value="bayes_loocv" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1200" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-64" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-17" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-17" value="n_bootstrap_itrs" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1280" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-18" value="bootstrap_noise" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1360" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-46" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-19" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-78" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-19" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-19" value="just_analysis" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1440" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-20" value="valid_metrics" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1520" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-52" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-21" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-21" value="plot_post_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1600" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-51" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-22" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-22" value="plot_map_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1680" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-23" value="max_a_posteriori" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1760" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-24" value="corner_title_fmt" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1840" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-34" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-25" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-25" value="out_dir" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="1920" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-26" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-26" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-26" value="error_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2000" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-56" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-27" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-72" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-27" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-27" value="bias_inputs" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2080" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-41" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-28" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-28" value="measurement_error" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2160" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-44" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-29" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-81" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-29" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-29" value="sigma2s" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2240" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-30" value="log_likes" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2320" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-82" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-31" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-31" value="dtype" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2400" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-32" value="create_inference" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="400" y="20" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-39" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-39" value="n_tot_measurement" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2480" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-42" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-42" value="Discrepancy" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2560" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-49" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-48" target="K5oJ7VEt7dPmeK6pba1f-32">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-59" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-48" target="K5oJ7VEt7dPmeK6pba1f-53">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-48" value="posterior_df" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2640" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-53" value="create_error_model" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="560" y="20" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-60" value="perform_bootstrap" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="720" y="20" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-75" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-69" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-69" value="__mean_pce_prior_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2720" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-76" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-70" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-70" value="_std_pce_prior_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2800" width="120" height="60" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-74" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="K5oJ7VEt7dPmeK6pba1f-73" target="K5oJ7VEt7dPmeK6pba1f-60">
+          <mxGeometry relative="1" as="geometry" />
+        </mxCell>
+        <mxCell id="K5oJ7VEt7dPmeK6pba1f-73" value="__model_prior_pred" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+          <mxGeometry x="40" y="2880" width="120" height="60" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+  <diagram id="QgiNX2WXFOBDsDgzoFY9" name="Folder structure">
+    <mxGraphModel dx="1206" dy="809" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+      <root>
+        <mxCell id="0" />
+        <mxCell id="1" parent="0" />
+        <mxCell id="KLYezTmecfuvBG8KQe-n-1" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="140" y="80" width="750" height="550" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-2" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="170" y="110" width="700" height="220" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-3" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="170" y="370" width="180" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-4" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="170" y="440" width="180" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-5" value="" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="170" y="500" width="180" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-6" value="adaptPlot" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="190" y="150" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-7" value="apoly_construction" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="280" y="150" width="140" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-8" value="bayes_linear" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="440" y="150" width="90" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-9" value="engine" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="550" y="150" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-11" value="eval_rec_rule" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="640" y="150" width="100" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-12" value="exp_designs" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="760" y="150" width="90" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-13" value="exploration" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="190" y="210" width="80" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-14" value="glexindex" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="290" y="210" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-15" value="input_space" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="380" y="210" width="80" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-16" value="inputs" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="480" y="210" width="70" height="50" as="geometry" />
+        </mxCell>
+        <mxCell id="KLYezTmecfuvBG8KQe-n-17" value="meta_model_engine" style="shape=folder;fontStyle=1;spacingTop=10;tabWidth=40;tabHeight=14;tabPosition=left;html=1;whiteSpace=wrap;" parent="1" vertex="1">
+          <mxGeometry x="570" y="210" width="160" height="50" as="geometry" />
+        </mxCell>
+      </root>
+    </mxGraphModel>
+  </diagram>
+</mxfile>
diff --git a/examples/analytical-function/example_analytical_function.py b/examples/analytical-function/example_analytical_function.py
index bdf22598a..09261acba 100644
--- a/examples/analytical-function/example_analytical_function.py
+++ b/examples/analytical-function/example_analytical_function.py
@@ -25,15 +25,21 @@ matplotlib.use('agg')
 
 # import bayesvalidrox
 # Add BayesValidRox path
+sys.path.append("src/")
 sys.path.append("../../src/")
 
+import bayesvalidrox
+from bayesvalidrox import PyLinkForwardModel
+
 from bayesvalidrox.pylink.pylink import PyLinkForwardModel
 from bayesvalidrox.surrogate_models.inputs import Input
 from bayesvalidrox.surrogate_models.exp_designs import ExpDesigns
 from bayesvalidrox.surrogate_models.surrogate_models import MetaModel
+#from bayesvalidrox.surrogate_models.meta_model_engine import MetaModelEngine
 from bayesvalidrox.post_processing.post_processing import PostProcessing
 from bayesvalidrox.bayes_inference.bayes_inference import BayesInference
 from bayesvalidrox.bayes_inference.discrepancy import Discrepancy
+
 from bayesvalidrox.surrogate_models.engine import Engine
 
 if __name__ == "__main__":
diff --git a/src/bayesvalidrox/surrogate_models/engine.py b/src/bayesvalidrox/surrogate_models/engine.py
index 086022ab0..24aa0c0d7 100644
--- a/src/bayesvalidrox/surrogate_models/engine.py
+++ b/src/bayesvalidrox/surrogate_models/engine.py
@@ -23,8 +23,7 @@ from tqdm import tqdm
 from bayesvalidrox.bayes_inference.bayes_inference import BayesInference
 from bayesvalidrox.bayes_inference.discrepancy import Discrepancy
 from .exploration import Exploration
-from.surrogate_models import MetaModel as MM
-from.surrogate_models import create_psi
+from .sequential_design import SequentialDesign
 
 
 def hellinger_distance(P, Q):
@@ -154,7 +153,6 @@ class Engine:
         self.SeqModifiedLOO = None
         self.valid_likelihoods = None
         self._y_hat_prev = None
-        self.emulator = False
 
     def start_engine(self) -> None:
         """
@@ -166,13 +164,7 @@ class Engine:
 
         """
         self.out_names = self.Model.Output.names
-        if isinstance(self.MetaModel, MM):
-            self.emulator = True
-            self.MetaModel.out_names = self.out_names
-            print('MetaModel has been given, `emulator` will be set to `True`')
-        else:
-            self.emulator = False
-            print('MetaModel has not been given, `emulator` will be set to `False`')
+        self.MetaModel.out_names = self.out_names
 
     def train_normal(self, parallel=False, verbose=False, save=False) -> None:
         """
@@ -187,7 +179,8 @@ class Engine:
         None
 
         """
-        self.start_engine()
+        if self.out_names == 'None':
+            self.start_engine()
 
         ExpDesign = self.ExpDesign
         MetaModel = self.MetaModel
@@ -206,13 +199,9 @@ class Engine:
 
         # Prepare X samples 
         # For training the surrogate use ExpDesign.X_tr, ExpDesign.X is for the model to run on 
-        if self.emulator:
-            maxdeg = np.max(MetaModel.pce_deg)
-        else:
-            maxdeg = 1
         ExpDesign.generate_ED(ExpDesign.n_init_samples,
-                              #transform=True,
-                              max_pce_deg=maxdeg)
+                              transform=True,
+                              max_pce_deg=np.max(MetaModel.pce_deg))
 
         # Run simulations at X 
         if not hasattr(ExpDesign, 'Y') or ExpDesign.Y is None:
@@ -233,14 +222,11 @@ class Engine:
             print('No x_values are given, this might lead to issues during PostProcessing')
 
         # Fit the surrogate
-        if self.emulator:
-            MetaModel.fit(ExpDesign.X, ExpDesign.Y, parallel, verbose)
+        MetaModel.fit(ExpDesign.X, ExpDesign.Y, parallel, verbose)
 
         # Save what there is to save
         if save:
             # Save surrogate
-            if not os.path.exists('surrogates/'):
-                os.makedirs('surrogates/')
             with open(f'surrogates/surrogate_{self.Model.name}.pk1', 'wb') as output:
                 joblib.dump(MetaModel, output, 2)
 
@@ -269,8 +255,7 @@ class Engine:
 
     # -------------------------------------------------------------------------
     def eval_metamodel(self, samples=None, nsamples=None,
-                       sampling_method='random', return_samples=False,
-                       parallel = False):
+                       sampling_method='random', return_samples=False):
         """
         Evaluates metamodel at the requested samples. One can also generate
         nsamples.
@@ -287,9 +272,6 @@ class Engine:
             'random'.
         return_samples : bool, optional
             Retun samples, if no `samples` is provided. The default is False.
-        parallel : bool, optional
-            Set to true if the evaluations should be done in parallel.
-            The default is False.
 
         Returns
         -------
@@ -308,22 +290,12 @@ class Engine:
 
         # Transformation to other space is to be done in the MetaModel
         # TODO: sort the transformations better
-        if self.emulator:
-            mean_pred, std_pred = self.MetaModel.eval_metamodel(samples)
-        else:
-            mean_pred , X = self.Model.run_model_parallel(samples, mp=parallel)
+        mean_pred, std_pred = self.MetaModel.eval_metamodel(samples)
 
         if return_samples:
-            if self.emulator:
-                return mean_pred, std_pred, samples
-            else:
-                return mean_pred, samples
+            return mean_pred, std_pred, samples
         else:
-            if self.emulator:
-                return mean_pred, std_pred
-            else:
-                return mean_pred, None
-                
+            return mean_pred, std_pred
 
     # -------------------------------------------------------------------------
     def train_seq_design(self, parallel=False, verbose=False):
@@ -374,6 +346,9 @@ class Engine:
         util_func = self.ExpDesign.util_func
         output_name = self.out_names
 
+        # Setup the Sequential Design object
+        self.SeqDes = SequentialDesign(self.MetaModel, self.Model, self.ExpDesign)
+
         # Handle if only one UtilityFunctions is provided
         if not isinstance(util_func, list):
             util_func = [self.ExpDesign.util_func]
@@ -510,9 +485,13 @@ class Engine:
 
                     # Optimal Bayesian Design
                     # self.MetaModel.ExpDesignFlag = 'sequential'
-                    Xnew, updatedPrior = self.choose_next_sample(TotalSigma2,
+                    Xnew, updatedPrior = self.SeqDesign.choose_next_sample(TotalSigma2,
                                                                  n_canddidate,
                                                                  util_f)
+
+#                    Xnew, updatedPrior = self.choose_next_sample(TotalSigma2,
+#                                                                 n_canddidate,
+#                                                                 util_f)
                     S = np.min(distance.cdist(Xinit, Xnew, 'euclidean'))
                     self.seqMinDist.append(S)
                     print(f"\nmin Dist from OldExpDesign: {S:2f}")
@@ -793,7 +772,6 @@ class Engine:
 
         #  Likelihood computation (Comparison of data and simulation
         #  results via PCE with candidate design)
-        print(Y_MC)
         likelihoods = self._normpdf(Y_MC, std_MC, obs_data, sigma2Dict)
 
         # Rejection Step
@@ -1169,6 +1147,7 @@ class Engine:
         method : string
             Exploitation method: `VarOptDesign`, `BayesActDesign` and
             `BayesOptDesign`.
+        # TODO: BayesActDesign has no corresponding function call in this function!
         Bounds : list of tuples
             List of lower and upper boundaries of parameters.
         sigma2Dict : dict
@@ -1262,7 +1241,7 @@ class Engine:
             itrNumber //= self.ExpDesign.n_new_samples
 
             tau2 = -(n_max_samples - initNSamples - 1) / np.log(1e-8)
-            exploration_weight = signal.windows.exponential(n_max_samples - initNSamples,
+            exploration_weight = signal.exponential(n_max_samples - initNSamples,
                                                     0, tau2, False)[itrNumber]
 
         elif tradeoff_scheme == 'adaptive':
@@ -1629,6 +1608,7 @@ class Engine:
 
             # Find sensitive region
             if UtilMethod == 'LOOCV':
+                # TODO: why is this not inside the VarOptDesign function?
                 LCerror = self.MetaModel.LCerror
                 allModifiedLOO = np.zeros((len(old_EDX), len(OutputNames),
                                            nMeasurement))
@@ -1638,7 +1618,6 @@ class Engine:
                             LCerror[y_key][key])
 
                 ExploitScore = np.max(np.max(allModifiedLOO, axis=1), axis=1)
-            # print(allModifiedLOO.shape)
 
             elif UtilMethod in ['EIGF', 'ALM']:
                 # ----- All other in  ['EIGF', 'ALM'] -----
@@ -1797,12 +1776,12 @@ class Engine:
 
         # ------ Old Psi ------------
         univ_p_val = self.MetaModel.univ_basis_vals(oldExpDesignX)
-        Psi = create_psi(BasisIndices, univ_p_val)
+        Psi = self.MetaModel.create_psi(BasisIndices, univ_p_val)
 
         # ------ New candidates (Psi_c) ------------
         # Assemble Psi_c
         univ_p_val_c = self.MetaModel.univ_basis_vals(candidates)
-        Psi_c = create_psi(BasisIndices, univ_p_val_c)
+        Psi_c = self.MetaModel.create_psi(BasisIndices, univ_p_val_c)
 
         for idx in range(NCandidate):
 
diff --git a/src/bayesvalidrox/surrogate_models/sequential_design.py b/src/bayesvalidrox/surrogate_models/sequential_design.py
new file mode 100644
index 000000000..322ebbbce
--- /dev/null
+++ b/src/bayesvalidrox/surrogate_models/sequential_design.py
@@ -0,0 +1,1716 @@
+# -*- coding: utf-8 -*-
+"""
+Engine to train the surrogate
+
+"""
+from copy import deepcopy, copy
+import joblib
+from joblib import Parallel, delayed
+import matplotlib.pyplot as plt
+import multiprocessing
+import numpy as np
+import os
+import pandas as pd
+import pathlib
+import scipy.optimize as opt
+from scipy import stats, signal, linalg, sparse
+from scipy.spatial import distance
+from sklearn.metrics import mean_squared_error
+import seaborn as sns
+import sys
+from tqdm import tqdm
+
+from bayesvalidrox.bayes_inference.bayes_inference import BayesInference
+from bayesvalidrox.bayes_inference.discrepancy import Discrepancy
+from .exploration import Exploration
+
+def logpdf(x, mean, cov):
+    """
+    Computes the likelihood based on a multivariate normal distribution.
+
+    Parameters
+    ----------
+    x : TYPE
+        DESCRIPTION.
+    mean : array_like
+        Observation data.
+    cov : 2d array
+        Covariance matrix of the distribution.
+
+    Returns
+    -------
+    log_lik : float
+        Log likelihood.
+
+    """
+    n = len(mean)
+    L = linalg.cholesky(cov, lower=True)
+    beta = np.sum(np.log(np.diag(L)))
+    dev = x - mean
+    alpha = dev.dot(linalg.cho_solve((L, True), dev))
+    log_lik = -0.5 * alpha - beta - n / 2. * np.log(2 * np.pi)
+
+    return log_lik
+
+
+def subdomain(Bounds, n_new_samples):
+    """
+    Divides a domain defined by Bounds into subdomains.
+
+    Parameters
+    ----------
+    Bounds : list of tuples
+        List of lower and upper bounds.
+    n_new_samples : int
+        Number of samples to divide the domain for.
+
+    Returns
+    -------
+    Subdomains : List of tuples of tuples
+        Each tuple of tuples divides one set of bounds into n_new_samples parts.
+
+    """
+    n_params = len(Bounds)
+    n_subdomains = n_new_samples + 1
+    LinSpace = np.zeros((n_params, n_subdomains))
+
+    for i in range(n_params):
+        LinSpace[i] = np.linspace(start=Bounds[i][0], stop=Bounds[i][1],
+                                  num=n_subdomains)
+    Subdomains = []
+    for k in range(n_subdomains - 1):
+        mylist = []
+        for i in range(n_params):
+            mylist.append((LinSpace[i, k + 0], LinSpace[i, k + 1]))
+        Subdomains.append(tuple(mylist))
+
+    return Subdomains
+
+class SequentialDesign:
+    """
+    Contains options for choosing the next training sample iteratively.
+
+    """
+
+    def __init__(self, MetaMod, Model, ExpDes, parallel=False):
+        self.MetaModel = MetaMod # Surrogate should be trained
+        self.Model = Model
+        self.ExpDesign = ExpDes
+        self.parallel = parallel
+
+        # Init other parameters
+
+    def start_seqdesign(self) -> None:
+        """
+        Do all the preparations that need to be run before the actual training
+
+        Returns
+        -------
+        None
+
+        """
+        None
+
+
+    # -------------------------------------------------------------------------
+    def choose_next_sample(self, sigma2=None, n_candidates=5, var='DKL'):
+        """
+        Runs optimal sequential design.
+
+        Parameters
+        ----------
+        sigma2 : dict, optional
+            A dictionary containing the measurement errors (sigma^2). The
+            default is None.
+        n_candidates : int, optional
+            Number of candidate samples. The default is 5.
+        var : string, optional
+            Utility function. The default is None. # TODO: default is set to DKL, not none
+
+        Raises
+        ------
+        NameError
+            Wrong utility function.
+
+        Returns
+        -------
+        Xnew : array (n_samples, n_params)
+            Selected new training point(s).
+        """
+
+        # Initialization
+        Bounds = self.ExpDesign.bound_tuples
+        n_new_samples = self.ExpDesign.n_new_samples
+        explore_method = self.ExpDesign.explore_method
+        exploit_method = self.ExpDesign.exploit_method
+        n_cand_groups = self.ExpDesign.n_cand_groups
+        tradeoff_scheme = self.ExpDesign.tradeoff_scheme
+
+        old_EDX = self.ExpDesign.X
+        old_EDY = self.ExpDesign.Y.copy()
+        ndim = self.ExpDesign.X.shape[1]
+        OutputNames = self.out_names
+
+        # -----------------------------------------
+        # ----------- CUSTOMIZED METHODS ----------
+        # -----------------------------------------
+        # Utility function exploit_method provided by user
+        if exploit_method.lower() == 'user':
+            # TODO: is the exploit_method meant here?
+            if not hasattr(self.ExpDesign, 'ExploitFunction') or self.ExpDesign.ExploitFunction is None:
+                raise AttributeError(
+                    'Function `ExploitFunction` not given to the ExpDesign, thus cannor run user-defined sequential'
+                    'scheme')
+            # TODO: syntax does not fully match the rest - can test this??
+            Xnew, filteredSamples = self.ExpDesign.ExploitFunction(self)
+
+            print("\n")
+            print("\nXnew:\n", Xnew)
+
+            return Xnew, filteredSamples
+
+        # Dual-Annealing works differently from the rest, so deal with this first
+        # Here exploration and exploitation are performed simulataneously
+        if explore_method == 'dual annealing':
+            # ------- EXPLORATION: OPTIMIZATION -------
+            import time
+            start_time = time.time()
+
+            # Divide the domain to subdomains
+            subdomains = subdomain(Bounds, n_new_samples)
+
+            # Multiprocessing
+            if self.parallel:
+                args = []
+                for i in range(n_new_samples):
+                    args.append((exploit_method, subdomains[i], sigma2, var, i))
+                pool = multiprocessing.Pool(multiprocessing.cpu_count())
+
+                # With Pool.starmap_async()
+                results = pool.starmap_async(self.dual_annealing, args).get()
+
+                # Close the pool
+                pool.close()
+            # Without multiprocessing
+            else:
+                results = []
+                for i in range(n_new_samples):
+                    results.append(self.dual_annealing(exploit_method, subdomains[i], sigma2, var, i))
+
+            # New sample
+            Xnew = np.array([results[i][1] for i in range(n_new_samples)])
+            print("\nXnew:\n", Xnew)
+
+            # Computational cost
+            elapsed_time = time.time() - start_time
+            print("\n")
+            print(f"Elapsed_time: {round(elapsed_time, 2)} sec.")
+            print('-' * 20)
+
+            return Xnew, None
+
+        # Generate needed Exploration class
+        explore = Exploration(self.ExpDesign, n_candidates)
+        explore.w = 100  # * ndim #500  # TODO: where does this value come from?
+
+        # Select criterion (mc-intersite-proj-th, mc-intersite-proj)
+        explore.mc_criterion = 'mc-intersite-proj'
+
+        # Generate the candidate samples
+        # TODO: here use the sampling method provided by the expdesign?
+        # sampling_method = self.ExpDesign.sampling_method
+
+        # TODO: changed this from 'random' for LOOCV
+        # TODO: these are commented out as they are not used !?
+        # if explore_method == 'LOOCV':
+        # allCandidates = self.ExpDesign.generate_samples(n_candidates,
+        #                                                     sampling_method)
+        # else:
+        #     allCandidates, scoreExploration = explore.get_exploration_samples()
+
+        # -----------------------------------------
+        # ---------- EXPLORATION METHODS ----------
+        # -----------------------------------------
+        if explore_method == 'LOOCV':
+            # -----------------------------------------------------------------
+            # TODO: LOOCV model construnction based on Feng et al. (2020)
+            # 'LOOCV':
+            # Initilize the ExploitScore array
+
+            # Generate random samples
+            allCandidates = self.ExpDesign.generate_samples(n_candidates,
+                                                            'random')
+
+            # Construct error model based on LCerror
+            errorModel = self.MetaModel.create_ModelError(old_EDX, self.LCerror)
+            self.errorModel.append(copy(errorModel))
+
+            # Evaluate the error models for allCandidates
+            eLCAllCands, _ = errorModel.eval_errormodel(allCandidates)
+            # Select the maximum as the representative error
+            eLCAllCands = np.dstack(eLCAllCands.values())
+            eLCAllCandidates = np.max(eLCAllCands, axis=1)[:, 0]
+
+            # Normalize the error w.r.t the maximum error
+            scoreExploration = eLCAllCandidates / np.sum(eLCAllCandidates)
+
+        else:
+            # ------- EXPLORATION: SPACE-FILLING DESIGN -------
+            # Generate candidate samples from Exploration class
+            explore = Exploration(self.ExpDesign, n_candidates)
+            explore.w = 100  # * ndim #500
+            # Select criterion (mc-intersite-proj-th, mc-intersite-proj)
+            explore.mc_criterion = 'mc-intersite-proj'
+            allCandidates, scoreExploration = explore.get_exploration_samples()
+
+            # Temp: ---- Plot all candidates -----
+            if ndim == 2:
+                def plotter(points, allCandidates, Method,
+                            scoreExploration=None):
+                    """
+                    unknown
+
+                    Parameters
+                    ----------
+                    points
+                    allCandidates
+                    Method
+                    scoreExploration
+
+                    Returns
+                    -------
+
+                    """
+                    if Method == 'Voronoi':
+                        from scipy.spatial import Voronoi, voronoi_plot_2d
+                        vor = Voronoi(points)
+                        fig = voronoi_plot_2d(vor)
+                        ax1 = fig.axes[0]
+                    else:
+                        fig = plt.figure()
+                        ax1 = fig.add_subplot(111)
+                    ax1.scatter(points[:, 0], points[:, 1], s=10, c='r',
+                                marker="s", label='Old Design Points')
+                    ax1.scatter(allCandidates[:, 0], allCandidates[:, 1], s=10,
+                                c='b', marker="o", label='Design candidates')
+                    for i in range(points.shape[0]):
+                        txt = 'p' + str(i + 1)
+                        ax1.annotate(txt, (points[i, 0], points[i, 1]))
+                    if scoreExploration is not None:
+                        for i in range(allCandidates.shape[0]):
+                            txt = str(round(scoreExploration[i], 5))
+                            ax1.annotate(txt, (allCandidates[i, 0],
+                                               allCandidates[i, 1]))
+
+                    plt.xlim(self.bound_tuples[0])
+                    plt.ylim(self.bound_tuples[1])
+                    # plt.show()
+                    plt.legend(loc='upper left')
+
+        # -----------------------------------------
+        # --------- EXPLOITATION METHODS ----------
+        # -----------------------------------------
+        if exploit_method.lower() == 'bayesoptdesign' or \
+                exploit_method.lower() == 'bayesactdesign':
+
+            # ------- Calculate Exoploration weight -------
+            # Compute exploration weight based on trade off scheme
+            explore_w, exploit_w = self.tradeoff_weights(tradeoff_scheme,
+                                                         old_EDX,
+                                                         old_EDY)
+            print(f"\n Exploration weight={explore_w:0.3f} "
+                  f"Exploitation weight={exploit_w:0.3f}\n")
+
+            # ------- EXPLOITATION: BayesOptDesign & ActiveLearning -------
+            if explore_w != 1.0:
+                # Check if all needed properties are set
+                if not hasattr(self.ExpDesign, 'max_func_itr'):
+                    raise AttributeError('max_func_itr not given to the experimental design')
+
+                # Create a sample pool for rejection sampling
+                MCsize = 15000
+                X_MC = self.ExpDesign.generate_samples(MCsize, 'random')
+                candidates = self.ExpDesign.generate_samples(
+                    n_candidates, 'latin_hypercube')
+
+                # Split the candidates in groups for multiprocessing
+                split_cand = np.array_split(
+                    candidates, n_cand_groups, axis=0
+                )
+                # print(candidates)
+                # print(split_cand)
+                if self.parallel:
+                    results = Parallel(n_jobs=-1, backend='multiprocessing')(
+                        delayed(self.run_util_func)(
+                            exploit_method, split_cand[i], i, sigma2, var, X_MC)
+                        for i in range(n_cand_groups))
+                else:
+                    results = []
+                    for i in range(n_cand_groups):
+                        results.append(self.run_util_func(exploit_method, split_cand[i], i, sigma2, var, X_MC))
+
+                # Retrieve the results and append them
+                U_J_d = np.concatenate([results[NofE][1] for NofE in
+                                        range(n_cand_groups)])
+
+                # Check if all scores are inf
+                if np.isinf(U_J_d).all() or np.isnan(U_J_d).all():
+                    U_J_d = np.ones(len(U_J_d))
+
+                # Get the expected value (mean) of the Utility score
+                # for each cell
+                if explore_method == 'Voronoi':
+                    U_J_d = np.mean(U_J_d.reshape(-1, n_candidates), axis=1)
+
+                # Normalize U_J_d
+                norm_U_J_d = U_J_d / np.sum(U_J_d)
+            else:
+                norm_U_J_d = np.zeros((len(scoreExploration)))
+
+            # ------- Calculate Total score -------
+            # ------- Trade off between EXPLORATION & EXPLOITATION -------
+            # Accumulate the samples
+            finalCandidates = np.concatenate((allCandidates, candidates), axis=0)
+            finalCandidates = np.unique(finalCandidates, axis=0)
+
+            # Calculations take into account both exploration and exploitation
+            # samples without duplicates
+            totalScore = np.zeros(finalCandidates.shape[0])
+            # self.totalScore = totalScore
+
+            for cand_idx in range(finalCandidates.shape[0]):
+                # find candidate indices
+                idx1 = np.where(allCandidates == finalCandidates[cand_idx])[0]
+                idx2 = np.where(candidates == finalCandidates[cand_idx])[0]
+
+                # exploration
+                if idx1.shape[0] > 0:
+                    idx1 = idx1[0]
+                    totalScore[cand_idx] += explore_w * scoreExploration[idx1]
+
+                # exploitation
+                if idx2.shape[0] > 0:
+                    idx2 = idx2[0]
+                    totalScore[cand_idx] += exploit_w * norm_U_J_d[idx2]
+
+            # Total score
+            totalScore = exploit_w * norm_U_J_d
+            totalScore += explore_w * scoreExploration
+
+            # temp: Plot
+            # dim = self.ExpDesign.X.shape[1]
+            # if dim == 2:
+            #     plotter(self.ExpDesign.X, allCandidates, explore_method)
+
+            # ------- Select the best candidate -------
+            # find an optimal point subset to add to the initial design by
+            # maximization of the utility score and taking care of NaN values
+            temp = totalScore.copy()
+            temp[np.isnan(totalScore)] = -np.inf
+            sorted_idxtotalScore = np.argsort(temp)[::-1]
+            bestIdx = sorted_idxtotalScore[:n_new_samples]
+
+            # select the requested number of samples
+            if explore_method == 'Voronoi':
+                Xnew = np.zeros((n_new_samples, ndim))
+                for i, idx in enumerate(bestIdx):
+                    X_can = explore.closestPoints[idx]
+
+                    # Calculate the maxmin score for the region of interest
+                    newSamples, maxminScore = explore.get_mc_samples(X_can)
+
+                    # select the requested number of samples
+                    Xnew[i] = newSamples[np.argmax(maxminScore)]
+            else:
+                # Changed this from allCandiates to full set of candidates
+                # TODO: still not changed for e.g. 'Voronoi'
+                Xnew = finalCandidates[sorted_idxtotalScore[:n_new_samples]]
+
+
+        elif exploit_method.lower() == 'varoptdesign':
+            # ------- EXPLOITATION: VarOptDesign -------
+            UtilMethod = var
+
+            # ------- Calculate Exoploration weight -------
+            # Compute exploration weight based on trade off scheme
+            explore_w, exploit_w = self.tradeoff_weights(tradeoff_scheme,
+                                                         old_EDX,
+                                                         old_EDY)
+            print(f"\nweightExploration={explore_w:0.3f} "
+                  f"weightExploitation={exploit_w:0.3f}")
+
+            # Generate candidate samples from Exploration class
+            nMeasurement = old_EDY[OutputNames[0]].shape[1]
+
+            # print(UtilMethod)
+
+            # Find sensitive region
+            if UtilMethod == 'LOOCV':
+                # TODO: why is this not inside the VarOptDesign function?
+                LCerror = self.MetaModel.LCerror
+                allModifiedLOO = np.zeros((len(old_EDX), len(OutputNames),
+                                           nMeasurement))
+                for y_idx, y_key in enumerate(OutputNames):
+                    for idx, key in enumerate(LCerror[y_key].keys()):
+                        allModifiedLOO[:, y_idx, idx] = abs(
+                            LCerror[y_key][key])
+
+                ExploitScore = np.max(np.max(allModifiedLOO, axis=1), axis=1)
+
+            elif UtilMethod in ['EIGF', 'ALM']:
+                # ----- All other in  ['EIGF', 'ALM'] -----
+                # Initilize the ExploitScore array
+                # ExploitScore = np.zeros((len(old_EDX), len(OutputNames)))
+
+                # Split the candidates in groups for multiprocessing
+                if explore_method != 'Voronoi':
+                    split_cand = np.array_split(allCandidates,
+                                                n_cand_groups,
+                                                axis=0)
+                    goodSampleIdx = range(n_cand_groups)
+                else:
+                    # Find indices of the Vornoi cells with samples
+                    goodSampleIdx = []
+                    for idx in range(len(explore.closest_points)):
+                        if len(explore.closest_points[idx]) != 0:
+                            goodSampleIdx.append(idx)
+                    split_cand = explore.closest_points
+
+                # Split the candidates in groups for multiprocessing
+                args = []
+                for index in goodSampleIdx:
+                    args.append((exploit_method, split_cand[index], index,
+                                 sigma2, var))
+
+                # Multiprocessing
+                pool = multiprocessing.Pool(multiprocessing.cpu_count())
+                # With Pool.starmap_async()
+                results = pool.starmap_async(self.run_util_func, args).get()
+
+                # Close the pool
+                pool.close()
+
+                # Retrieve the results and append them
+                if explore_method == 'Voronoi':
+                    ExploitScore = [np.mean(results[k][1]) for k in
+                                    range(len(goodSampleIdx))]
+                else:
+                    ExploitScore = np.concatenate(
+                        [results[k][1] for k in range(len(goodSampleIdx))])
+
+            else:
+                raise NameError('The requested utility function is not '
+                                'available.')
+
+            # print("ExploitScore:\n", ExploitScore)
+
+            # find an optimal point subset to add to the initial design by
+            # maximization of the utility score and taking care of NaN values
+            # Total score
+            # Normalize U_J_d
+            ExploitScore = ExploitScore / np.sum(ExploitScore)
+            totalScore = exploit_w * ExploitScore
+            # print(totalScore.shape)
+            # print(explore_w)
+            # print(scoreExploration.shape)
+            totalScore += explore_w * scoreExploration
+
+            temp = totalScore.copy()
+            sorted_idxtotalScore = np.argsort(temp, axis=0)[::-1]
+            bestIdx = sorted_idxtotalScore[:n_new_samples]
+
+            Xnew = np.zeros((n_new_samples, ndim))
+            if explore_method != 'Voronoi':
+                Xnew = allCandidates[bestIdx]
+            else:
+                for i, idx in enumerate(bestIdx.flatten()):
+                    X_can = explore.closest_points[idx]
+                    # plotter(self.ExpDesign.X, X_can, explore_method,
+                    # scoreExploration=None)
+
+                    # Calculate the maxmin score for the region of interest
+                    newSamples, maxminScore = explore.get_mc_samples(X_can)
+
+                    # select the requested number of samples
+                    Xnew[i] = newSamples[np.argmax(maxminScore)]
+
+        elif exploit_method.lower() == 'alphabetic':
+            # ------- EXPLOITATION: ALPHABETIC -------
+            Xnew = self.util_AlphOptDesign(allCandidates, var)
+
+        elif exploit_method == 'Space-filling':
+            # ------- EXPLOITATION: SPACE-FILLING -------
+            totalScore = scoreExploration
+
+            # ------- Select the best candidate -------
+            # find an optimal point subset to add to the initial design by
+            # maximization of the utility score and taking care of NaN values
+            temp = totalScore.copy()
+            temp[np.isnan(totalScore)] = -np.inf
+            sorted_idxtotalScore = np.argsort(temp)[::-1]
+
+            # select the requested number of samples
+            Xnew = allCandidates[sorted_idxtotalScore[:n_new_samples]]
+
+        else:
+            raise NameError('The requested design method is not available.')
+
+        print("\n")
+        print("\nRun No. {}:".format(old_EDX.shape[0] + 1))
+        print("Xnew:\n", Xnew)
+
+        # TODO: why does it also return None?
+        return Xnew, None
+
+    # -------------------------------------------------------------------------
+    def tradeoff_weights(self, tradeoff_scheme, old_EDX, old_EDY):
+        """
+        Calculates weights for exploration scores based on the requested
+        scheme: `None`, `equal`, `epsilon-decreasing` and `adaptive`.
+
+        `None`: No exploration.
+        `equal`: Same weights for exploration and exploitation scores.
+        `epsilon-decreasing`: Start with more exploration and increase the
+            influence of exploitation along the way with an exponential decay
+            function
+        `adaptive`: An adaptive method based on:
+            Liu, Haitao, Jianfei Cai, and Yew-Soon Ong. "An adaptive sampling
+            approach for Kriging metamodeling by maximizing expected prediction
+            error." Computers & Chemical Engineering 106 (2017): 171-182.
+
+        Parameters
+        ----------
+        tradeoff_scheme : string
+            Trade-off scheme for exloration and exploitation scores.
+        old_EDX : array (n_samples, n_params)
+            Old experimental design (training points).
+        old_EDY : dict
+            Old model responses (targets).
+
+        Returns
+        -------
+        exploration_weight : float
+            Exploration weight.
+        exploitation_weight: float
+            Exploitation weight.
+
+        """
+        exploration_weight = None
+
+        if tradeoff_scheme is None:
+            exploration_weight = 0
+
+        elif tradeoff_scheme == 'equal':
+            exploration_weight = 0.5
+
+        elif tradeoff_scheme == 'epsilon-decreasing':
+            # epsilon-decreasing scheme
+            # Start with more exploration and increase the influence of
+            # exploitation along the way with an exponential decay function
+            initNSamples = self.ExpDesign.n_init_samples
+            n_max_samples = self.ExpDesign.n_max_samples
+
+            itrNumber = (self.ExpDesign.X.shape[0] - initNSamples)
+            itrNumber //= self.ExpDesign.n_new_samples
+
+            tau2 = -(n_max_samples - initNSamples - 1) / np.log(1e-8)
+            exploration_weight = signal.exponential(n_max_samples - initNSamples,
+                                                    0, tau2, False)[itrNumber]
+
+        elif tradeoff_scheme == 'adaptive':
+
+            # Extract itrNumber
+            initNSamples = self.ExpDesign.n_init_samples
+            # n_max_samples = self.ExpDesign.n_max_samples
+            itrNumber = (self.ExpDesign.X.shape[0] - initNSamples)
+            itrNumber //= self.ExpDesign.n_new_samples
+
+            if itrNumber == 0:
+                exploration_weight = 0.5
+            else:
+                # New adaptive trade-off according to Liu et al. (2017)
+                # Mean squared error for last design point
+                last_EDX = old_EDX[-1].reshape(1, -1)
+                lastPCEY, _ = self.MetaModel.eval_metamodel(samples=last_EDX)
+                pce_y = np.array(list(lastPCEY.values()))[:, 0]
+                y = np.array(list(old_EDY.values()))[:, -1, :]
+                mseError = mean_squared_error(pce_y, y)
+
+                # Mean squared CV - error for last design point
+                pce_y_prev = np.array(list(self._y_hat_prev.values()))[:, 0]
+                mseCVError = mean_squared_error(pce_y_prev, y)
+
+                exploration_weight = min([0.5 * mseError / mseCVError, 1])
+
+        # Exploitation weight
+        exploitation_weight = 1 - exploration_weight
+
+        return exploration_weight, exploitation_weight
+
+    # -------------------------------------------------------------------------
+    def run_util_func(self, method, candidates, index, sigma2Dict=None,
+                      var=None, X_MC=None):
+        """
+        Runs the utility function based on the given method.
+
+        Parameters
+        ----------
+        method : string
+            Exploitation method: `VarOptDesign`, `BayesActDesign` and
+            `BayesOptDesign`.
+        candidates : array of shape (n_samples, n_params)
+            All candidate parameter sets.
+        index : int
+            ExpDesign index.
+        sigma2Dict : dict, optional
+            A dictionary containing the measurement errors (sigma^2). The
+            default is None.
+        var : string, optional
+            Utility function. The default is None.
+        X_MC : TYPE, optional
+            DESCRIPTION. The default is None.
+
+        Returns
+        -------
+        index : TYPE
+            DESCRIPTION.
+        List
+            Scores.
+
+        """
+
+        if method.lower() == 'varoptdesign':
+            # U_J_d = self.util_VarBasedDesign(candidates, index, var)
+            U_J_d = np.zeros((candidates.shape[0]))
+            for idx, X_can in tqdm(enumerate(candidates), ascii=True,
+                                   desc="varoptdesign"):
+                U_J_d[idx] = self.util_VarBasedDesign(X_can, index, var)
+
+        elif method.lower() == 'bayesactdesign':
+            NCandidate = candidates.shape[0]
+            U_J_d = np.zeros(NCandidate)
+            # Evaluate all candidates
+            y_can, std_can = self.MetaModel.eval_metamodel(samples=candidates)
+            # loop through candidates
+            for idx, X_can in tqdm(enumerate(candidates), ascii=True,
+                                   desc="BAL Design"):
+                y_hat = {key: items[idx] for key, items in y_can.items()}
+                std = {key: items[idx] for key, items in std_can.items()}
+
+                # print(y_hat)
+                # print(std)
+                U_J_d[idx] = self.util_BayesianActiveDesign(
+                    y_hat, std, sigma2Dict, var)
+
+        elif method.lower() == 'bayesoptdesign':
+            NCandidate = candidates.shape[0]
+            U_J_d = np.zeros(NCandidate)
+            for idx, X_can in tqdm(enumerate(candidates), ascii=True,
+                                   desc="OptBayesianDesign"):
+                U_J_d[idx] = self.util_BayesianDesign(X_can, X_MC, sigma2Dict,
+                                                      var)
+        return index, -1 * U_J_d
+
+
+    # -------------------------------------------------------------------------
+    def util_VarBasedDesign(self, X_can, index, util_func='Entropy'):
+        """
+        Computes the exploitation scores based on:
+        active learning MacKay(ALM) and active learning Cohn (ALC)
+        Paper: Sequential Design with Mutual Information for Computer
+        Experiments (MICE): Emulation of a Tsunami Model by Beck and Guillas
+        (2016)
+
+        Parameters
+        ----------
+        X_can : array of shape (n_samples, n_params)
+            Candidate samples.
+        index : int
+            Model output index.
+        util_func : string, optional
+            Exploitation utility function. The default is 'Entropy'.
+
+        Returns
+        -------
+        float
+            Score.
+
+        """
+        MetaModel = self.MetaModel
+        ED_X = self.ExpDesign.X
+        out_dict_y = self.ExpDesign.Y
+        out_names = self.out_names
+
+        # Run the Metamodel for the candidate
+        X_can = X_can.reshape(1, -1)
+        Y_PC_can, std_PC_can = MetaModel.eval_metamodel(samples=X_can)
+
+        score = None
+        if util_func.lower() == 'alm':
+            # ----- Entropy/MMSE/active learning MacKay(ALM)  -----
+            # Compute perdiction variance of the old model
+            canPredVar = {key: std_PC_can[key] ** 2 for key in out_names}
+
+            varPCE = np.zeros((len(out_names), X_can.shape[0]))
+            for KeyIdx, key in enumerate(out_names):
+                varPCE[KeyIdx] = np.max(canPredVar[key], axis=1)
+            score = np.max(varPCE, axis=0)
+
+        elif util_func.lower() == 'eigf':
+            # ----- Expected Improvement for Global fit -----
+            # Find closest EDX to the candidate
+            distances = distance.cdist(ED_X, X_can, 'euclidean')
+            index = np.argmin(distances)
+
+            # Compute perdiction error and variance of the old model
+            predError = {key: Y_PC_can[key] for key in out_names}
+            canPredVar = {key: std_PC_can[key] ** 2 for key in out_names}
+
+            # Compute perdiction error and variance of the old model
+            # Eq (5) from Liu et al.(2018)
+            EIGF_PCE = np.zeros((len(out_names), X_can.shape[0]))
+            for KeyIdx, key in enumerate(out_names):
+                residual = predError[key] - out_dict_y[key][int(index)]
+                var = canPredVar[key]
+                EIGF_PCE[KeyIdx] = np.max(residual ** 2 + var, axis=1)
+            score = np.max(EIGF_PCE, axis=0)
+
+        return -1 * score  # -1 is for minimization instead of maximization
+
+    # -------------------------------------------------------------------------
+    def util_BayesianActiveDesign(self, y_hat, std, sigma2Dict, var='DKL'):
+        """
+        Computes scores based on Bayesian active design criterion (var).
+
+        It is based on the following paper:
+        Oladyshkin, Sergey, Farid Mohammadi, Ilja Kroeker, and Wolfgang Nowak.
+        "Bayesian3 active learning for the gaussian process emulator using
+        information theory." Entropy 22, no. 8 (2020): 890.
+
+        Parameters
+        ----------
+        y_hat : unknown
+        std : unknown
+        sigma2Dict : dict
+            A dictionary containing the measurement errors (sigma^2).
+        var : string, optional
+            BAL design criterion. The default is 'DKL'.
+
+        Returns
+        -------
+        float
+            Score.
+
+        """
+
+        # Get the data
+        obs_data = self.observations
+        # TODO: this should be optimizable to be calculated explicitly
+        if hasattr(self.Model, 'n_obs'):
+            n_obs = self.Model.n_obs
+        else:
+            n_obs = self.n_obs
+        mc_size = 10000
+
+        # Sample a distribution for a normal dist
+        # with Y_mean_can as the mean and Y_std_can as std.
+        Y_MC, std_MC = {}, {}
+        logPriorLikelihoods = np.zeros(mc_size)
+        for key in list(y_hat):
+            cov = np.diag(std[key] ** 2)
+            print(key, y_hat[key], std[key])
+            # TODO: added the allow_singular = True here
+            rv = stats.multivariate_normal(mean=y_hat[key], cov=cov, allow_singular=True)
+            Y_MC[key] = rv.rvs(size=mc_size)
+            logPriorLikelihoods += rv.logpdf(Y_MC[key])
+            std_MC[key] = np.zeros((mc_size, y_hat[key].shape[0]))
+
+        #  Likelihood computation (Comparison of data and simulation
+        #  results via PCE with candidate design)
+        likelihoods = self._normpdf(Y_MC, std_MC, obs_data, sigma2Dict)
+
+        # Rejection Step
+        # Random numbers between 0 and 1
+        unif = np.random.rand(1, mc_size)[0]
+
+        # Reject the poorly performed prior
+        accepted = (likelihoods / np.max(likelihoods)) >= unif
+
+        # Prior-based estimation of BME
+        logBME = np.log(np.nanmean(likelihoods), dtype=np.longdouble)  # float128)
+
+        # Posterior-based expectation of likelihoods
+        postLikelihoods = likelihoods[accepted]
+        postExpLikelihoods = np.mean(np.log(postLikelihoods))
+
+        # Posterior-based expectation of prior densities
+        postExpPrior = np.mean(logPriorLikelihoods[accepted])
+
+        # Utility function Eq.2 in Ref. (2)
+        # Posterior covariance matrix after observing data y
+        # Kullback-Leibler Divergence (Sergey's paper)
+        U_J_d = None
+        if var == 'DKL':
+
+            # TODO: Calculate the correction factor for BME
+            # BMECorrFactor = self.BME_Corr_Weight(PCE_SparseBayes_can,
+            #                                      ObservationData, sigma2Dict)
+            # BME += BMECorrFactor
+            # Haun et al implementation
+            # U_J_d = np.mean(np.log(Likelihoods[Likelihoods!=0])- logBME)
+            U_J_d = postExpLikelihoods - logBME
+
+        # Marginal log likelihood
+        elif var == 'BME':
+            U_J_d = np.nanmean(likelihoods)
+
+        # Entropy-based information gain
+        elif var == 'infEntropy':
+            logBME = np.log(np.nanmean(likelihoods))
+            infEntropy = logBME - postExpPrior - postExpLikelihoods
+            U_J_d = infEntropy * -1  # -1 for minimization
+
+        # Bayesian information criterion
+        elif var == 'BIC':
+            coeffs = self.MetaModel.coeffs_dict.values()
+            nModelParams = max(len(v) for val in coeffs for v in val.values())
+            maxL = np.nanmax(likelihoods)
+            U_J_d = -2 * np.log(maxL) + np.log(n_obs) * nModelParams
+
+        # Akaike information criterion
+        elif var == 'AIC':
+            coeffs = self.MetaModel.coeffs_dict.values()
+            nModelParams = max(len(v) for val in coeffs for v in val.values())
+            maxlogL = np.log(np.nanmax(likelihoods))
+            AIC = -2 * maxlogL + 2 * nModelParams
+            # 2 * nModelParams * (nModelParams+1) / (n_obs-nModelParams-1)
+            penTerm = 0
+            U_J_d = 1 * (AIC + penTerm)
+
+        # Deviance information criterion
+        elif var == 'DIC':
+            # D_theta_bar = np.mean(-2 * Likelihoods)
+            N_star_p = 0.5 * np.var(np.log(likelihoods[likelihoods != 0]))
+            Likelihoods_theta_mean = self._normpdf(
+                y_hat, std, obs_data, sigma2Dict
+            )
+            DIC = -2 * np.log(Likelihoods_theta_mean) + 2 * N_star_p
+
+            U_J_d = DIC
+
+        else:
+            print('The algorithm you requested has not been implemented yet!')
+
+        # Handle inf and NaN (replace by zero)
+        if np.isnan(U_J_d) or U_J_d == -np.inf or U_J_d == np.inf:
+            U_J_d = 0.0
+
+        # Clear memory
+        del likelihoods
+        del Y_MC
+        del std_MC
+
+        return -1 * U_J_d  # -1 is for minimization instead of maximization
+
+    # -------------------------------------------------------------------------
+    def util_BayesianDesign(self, X_can, X_MC, sigma2Dict, var='DKL'):
+        """
+        Computes scores based on Bayesian sequential design criterion (var).
+
+        Parameters
+        ----------
+        X_can : array of shape (n_samples, n_params)
+            Candidate samples.
+        X_MC : unknown
+        sigma2Dict : dict
+            A dictionary containing the measurement errors (sigma^2).
+        var : string, optional
+            Bayesian design criterion. The default is 'DKL'.
+
+        Returns
+        -------
+        float
+            Score.
+
+        """
+
+        # To avoid changes ub original aPCE object
+        MetaModel = self.MetaModel
+        out_names = self.out_names
+        if X_can.ndim == 1:
+            X_can = X_can.reshape(1, -1)
+
+        # Compute the mean and std based on the MetaModel
+        # pce_means, pce_stds = self._compute_pce_moments(MetaModel)
+        if var == 'ALC':
+            Y_MC, Y_MC_std = MetaModel.eval_metamodel(samples=X_MC)
+
+        # Old Experimental design
+        oldExpDesignX = self.ExpDesign.X
+        oldExpDesignY = self.ExpDesign.Y
+
+        # Evaluate the PCE metamodels at that location ???
+        Y_PC_can, Y_std_can = MetaModel.eval_metamodel(samples=X_can)
+        PCE_Model_can = deepcopy(MetaModel)
+        engine_can = deepcopy(self)
+        # Add the candidate to the ExpDesign
+        NewExpDesignX = np.vstack((oldExpDesignX, X_can))
+
+        NewExpDesignY = {}
+        for key in oldExpDesignY.keys():
+            NewExpDesignY[key] = np.vstack(
+                (oldExpDesignY[key], Y_PC_can[key])
+            )
+
+        engine_can.ExpDesign.sampling_method = 'user'
+        engine_can.ExpDesign.X = NewExpDesignX
+        # engine_can.ModelOutputDict = NewExpDesignY
+        engine_can.ExpDesign.Y = NewExpDesignY
+
+        # Train the model for the observed data using x_can
+        engine_can.MetaModel.input_obj.poly_coeffs_flag = False
+        engine_can.start_engine()
+        engine_can.train_normal(parallel=False)
+        engine_can.MetaModel.fit(NewExpDesignX, NewExpDesignY)
+        #        engine_can.train_norm_design(parallel=False)
+
+        # Set the ExpDesign to its original values
+        engine_can.ExpDesign.X = oldExpDesignX
+        engine_can.ModelOutputDict = oldExpDesignY
+        engine_can.ExpDesign.Y = oldExpDesignY
+
+        if var.lower() == 'mi':
+            # Mutual information based on Krause et al.
+            # Adapted from Beck & Guillas (MICE) paper
+            _, std_PC_can = engine_can.MetaModel.eval_metamodel(samples=X_can)
+            std_can = {key: std_PC_can[key] for key in out_names}
+
+            std_old = {key: Y_std_can[key] for key in out_names}
+
+            varPCE = np.zeros((len(out_names)))
+            for i, key in enumerate(out_names):
+                varPCE[i] = np.mean(std_old[key] ** 2 / std_can[key] ** 2)
+            score = np.mean(varPCE)
+
+            return -1 * score
+
+        elif var.lower() == 'alc':
+            # Active learning based on Gramyc and Lee
+            # Adaptive design and analysis of supercomputer experiments Techno-
+            # metrics, 51 (2009), pp. 130–145.
+
+            # Evaluate the MetaModel at the given samples
+            Y_MC_can, Y_MC_std_can = engine_can.MetaModel.eval_metamodel(samples=X_MC)
+
+            # Compute the score
+            score = []
+            for i, key in enumerate(out_names):
+                pce_var = Y_MC_std_can[key] ** 2
+                pce_var_can = Y_MC_std[key] ** 2
+                score.append(np.mean(pce_var - pce_var_can, axis=0))
+            score = np.mean(score)
+
+            return -1 * score
+
+        # ---------- Inner MC simulation for computing Utility Value ----------
+        # Estimation of the integral via Monte Varlo integration
+        MCsize = X_MC.shape[0]
+        ESS = 0
+
+        likelihoods = None
+        while (ESS > MCsize) or (ESS < 1):
+
+            # Enriching Monte Carlo samples if need be
+            if ESS != 0:
+                X_MC = self.ExpDesign.generate_samples(
+                    MCsize, 'random'
+                )
+
+            # Evaluate the MetaModel at the given samples
+            Y_MC, std_MC = PCE_Model_can.eval_metamodel(samples=X_MC)
+
+            # Likelihood computation (Comparison of data and simulation
+            # results via PCE with candidate design)
+            likelihoods = self._normpdf(
+                Y_MC, std_MC, self.observations, sigma2Dict
+            )
+
+            # Check the Effective Sample Size (1<ESS<MCsize)
+            ESS = 1 / np.sum(np.square(likelihoods / np.sum(likelihoods)))
+
+            # Enlarge sample size if it doesn't fulfill the criteria
+            if (ESS > MCsize) or (ESS < 1):
+                print("--- increasing MC size---")
+                MCsize *= 10
+                ESS = 0
+
+        # Rejection Step
+        # Random numbers between 0 and 1
+        unif = np.random.rand(1, MCsize)[0]
+
+        # Reject the poorly performed prior
+        accepted = (likelihoods / np.max(likelihoods)) >= unif
+
+        # -------------------- Utility functions --------------------
+        # Utility function Eq.2 in Ref. (2)
+        # Kullback-Leibler Divergence (Sergey's paper)
+        U_J_d = None
+        if var == 'DKL':
+
+            # Prior-based estimation of BME
+            logBME = np.log(np.nanmean(likelihoods, dtype=np.longdouble))  # float128))
+
+            # Posterior-based expectation of likelihoods
+            # postLikelihoods = likelihoods[accepted]
+            # postExpLikelihoods = np.mean(np.log(postLikelihoods))
+
+            # Haun et al implementation
+            U_J_d = np.mean(np.log(likelihoods[likelihoods != 0]) - logBME)
+
+            # U_J_d = np.sum(G_n_m_all)
+            # Ryan et al (2014) implementation
+            # importanceWeights = Likelihoods[Likelihoods!=0]/np.sum(Likelihoods[Likelihoods!=0])
+            # U_J_d = np.mean(importanceWeights*np.log(Likelihoods[Likelihoods!=0])) - logBME
+
+            # U_J_d = postExpLikelihoods - logBME
+
+        # Marginal likelihood
+        elif var == 'BME':
+
+            # Prior-based estimation of BME
+            logBME = np.log(np.nanmean(likelihoods))
+            U_J_d = logBME
+
+        # Bayes risk likelihood
+        elif var == 'BayesRisk':
+
+            U_J_d = -1 * np.var(likelihoods)
+
+        # Entropy-based information gain
+        elif var == 'infEntropy':
+            # Prior-based estimation of BME
+            logBME = np.log(np.nanmean(likelihoods))
+
+            # Posterior-based expectation of likelihoods
+            postLikelihoods = likelihoods[accepted]
+            postLikelihoods /= np.nansum(likelihoods[accepted])
+            postExpLikelihoods = np.mean(np.log(postLikelihoods))
+
+            # Posterior-based expectation of prior densities
+            logPriorLikelihoods = []
+            logPriorLikelihoods[accepted] = None  # TODO: this is not defined here, just a fix
+            postExpPrior = np.mean(logPriorLikelihoods[accepted])
+
+            infEntropy = logBME - postExpPrior - postExpLikelihoods
+
+            U_J_d = infEntropy * -1  # -1 for minimization
+
+        # D-Posterior-precision
+        elif var == 'DPP':
+            X_Posterior = X_MC[accepted]
+            # covariance of the posterior parameters
+            U_J_d = -np.log(np.linalg.det(np.cov(X_Posterior)))
+
+        # A-Posterior-precision
+        elif var == 'APP':
+            X_Posterior = X_MC[accepted]
+            # trace of the posterior parameters
+            U_J_d = -np.log(np.trace(np.cov(X_Posterior)))
+
+        else:
+            print('The algorithm you requested has not been implemented yet!')
+
+        # Clear memory
+        del likelihoods
+        del Y_MC
+        del std_MC
+
+        return -1 * U_J_d  # -1 is for minimization instead of maximization
+
+    # -------------------------------------------------------------------------
+    def dual_annealing(self, method, Bounds, sigma2Dict, var, Run_No,
+                       verbose=False):
+        """
+        Exploration algorithm to find the optimum parameter space.
+
+        Parameters
+        ----------
+        method : string
+            Exploitation method: `VarOptDesign`, `BayesActDesign` and
+            `BayesOptDesign`.
+        # TODO: BayesActDesign has no corresponding function call in this function!
+        Bounds : list of tuples
+            List of lower and upper boundaries of parameters.
+        sigma2Dict : dict
+            A dictionary containing the measurement errors (sigma^2).
+        var : unknown
+        Run_No : int
+            Run number.
+        verbose : bool, optional
+            Print out a summary. The default is False.
+
+        Returns
+        -------
+        Run_No : int
+            Run number.
+        array
+            Optimial candidate.
+
+        """
+
+        Model = self.Model
+        max_func_itr = self.ExpDesign.max_func_itr
+
+        Res_Global = None
+        if method.lower() == 'varoptdesign':
+            Res_Global = opt.dual_annealing(self.util_VarBasedDesign,
+                                            bounds=Bounds,
+                                            args=(Model, var),
+                                            maxfun=max_func_itr)
+
+        elif method.lower() == 'bayesoptdesign':
+            Res_Global = opt.dual_annealing(self.util_BayesianDesign,
+                                            bounds=Bounds,
+                                            args=(Model, sigma2Dict, var),
+                                            maxfun=max_func_itr)
+
+        if verbose:
+            print(f"Global minimum: xmin = {Res_Global.x}, "
+                  f"f(xmin) = {Res_Global.fun:.6f}, nfev = {Res_Global.nfev}")
+
+        return Run_No, Res_Global.x
+
+    # -------------------------------------------------------------------------
+    def util_AlphOptDesign(self, candidates, var='D-Opt'):
+        """
+        Enriches the Experimental design with the requested alphabetic
+        criterion based on exploring the space with number of sampling points.
+
+        Ref: Hadigol, M., & Doostan, A. (2018). Least squares polynomial chaos
+        expansion: A review of sampling strategies., Computer Methods in
+        Applied Mechanics and Engineering, 332, 382-407.
+
+        Arguments
+        ---------
+        candidates : int?
+            Number of candidate points to be searched
+
+        var : string
+            Alphabetic optimality criterion
+
+        Returns
+        -------
+        X_new : array of shape (1, n_params)
+            The new sampling location in the input space.
+        """
+        MetaModelOrig = self  # TODO: this doesn't fully seem correct?
+        n_new_samples = MetaModelOrig.ExpDesign.n_new_samples
+        NCandidate = candidates.shape[0]
+
+        # TODO: Loop over outputs
+        OutputName = self.out_names[0]
+
+        # To avoid changes ub original aPCE object
+        # MetaModel = deepcopy(MetaModelOrig)
+
+        # Old Experimental design
+        oldExpDesignX = self.ExpDesign.X
+
+        # TODO: Only one psi can be selected.
+        # Suggestion: Go for the one with the highest LOO error
+        # TODO: this is just a patch, need to look at again!
+        Scores = list(self.MetaModel.score_dict['b_1'][OutputName].values())
+        ModifiedLOO = [1 - score for score in Scores]
+        outIdx = np.argmax(ModifiedLOO)
+
+        # Initialize Phi to save the criterion's values
+        Phi = np.zeros(NCandidate)
+
+        # TODO: also patched here
+        BasisIndices = self.MetaModel.basis_dict['b_1'][OutputName]["y_" + str(outIdx + 1)]
+        P = len(BasisIndices)
+
+        # ------ Old Psi ------------
+        univ_p_val = self.MetaModel.univ_basis_vals(oldExpDesignX)
+        Psi = self.MetaModel.create_psi(BasisIndices, univ_p_val)
+
+        # ------ New candidates (Psi_c) ------------
+        # Assemble Psi_c
+        univ_p_val_c = self.MetaModel.univ_basis_vals(candidates)
+        Psi_c = self.MetaModel.create_psi(BasisIndices, univ_p_val_c)
+
+        for idx in range(NCandidate):
+
+            # Include the new row to the original Psi
+            Psi_cand = np.vstack((Psi, Psi_c[idx]))
+
+            # Information matrix
+            PsiTPsi = np.dot(Psi_cand.T, Psi_cand)
+            M = PsiTPsi / (len(oldExpDesignX) + 1)
+
+            if 1e-12 < np.linalg.cond(PsiTPsi) < 1 / sys.float_info.epsilon:
+                # faster
+                invM = linalg.solve(M, sparse.eye(PsiTPsi.shape[0]).toarray())
+            else:
+                # stabler
+                invM = np.linalg.pinv(M)
+
+            # ---------- Calculate optimality criterion ----------
+            # Optimality criteria according to Section 4.5.1 in Ref.
+
+            # D-Opt
+            if var.lower() == 'd-opt':
+                Phi[idx] = (np.linalg.det(invM)) ** (1 / P)
+
+            # A-Opt
+            elif var.lower() == 'a-opt':
+                Phi[idx] = np.trace(invM)
+
+            # K-Opt
+            elif var.lower() == 'k-opt':
+                Phi[idx] = np.linalg.cond(M)
+
+            else:
+                # print(var.lower())
+                raise Exception('The optimality criterion you requested has '
+                                'not been implemented yet!')
+
+        # find an optimal point subset to add to the initial design
+        # by minimization of the Phi
+        sorted_idxtotalScore = np.argsort(Phi)
+
+        # select the requested number of samples
+        Xnew = candidates[sorted_idxtotalScore[:n_new_samples]]
+
+        return Xnew
+
+    # -------------------------------------------------------------------------
+    def _normpdf(self, y_hat_pce, std_pce, obs_data, total_sigma2s,
+                 rmse=None):
+        """
+        Calculated gaussian likelihood for given y+std based on given obs+sigma
+        # TODO: is this understanding correct?
+        
+        Parameters
+        ----------
+        y_hat_pce : dict of 2d np arrays
+            Mean output of the surrogate.
+        std_pce : dict of 2d np arrays
+            Standard deviation output of the surrogate.
+        obs_data : dict of 1d np arrays
+            Observed data.
+        total_sigma2s : pandas dataframe, matches obs_data
+            Estimated uncertainty for the observed data.
+        rmse : dict, optional
+            RMSE values from validation of the surrogate. The default is None.
+
+        Returns
+        -------
+        likelihoods : dict of float
+            The likelihood for each surrogate eval in y_hat_pce compared to the
+            observations (?).
+
+        """
+
+        likelihoods = 1.0
+
+        # Loop over the outputs
+        for idx, out in enumerate(self.out_names):
+
+            # (Meta)Model Output
+            # print(y_hat_pce[out])
+            nsamples, nout = y_hat_pce[out].shape
+
+            # Prepare data and remove NaN
+            try:
+                data = obs_data[out].values[~np.isnan(obs_data[out])]
+            except AttributeError:
+                data = obs_data[out][~np.isnan(obs_data[out])]
+
+            # Prepare sigma2s
+            non_nan_indices = ~np.isnan(total_sigma2s[out])
+            tot_sigma2s = total_sigma2s[out][non_nan_indices][:nout].values
+
+            # Surrogate error if valid dataset is given.
+            if rmse is not None:
+                tot_sigma2s += rmse[out] ** 2
+            else:
+                tot_sigma2s += np.mean(std_pce[out]) ** 2
+
+            likelihoods *= stats.multivariate_normal.pdf(
+                y_hat_pce[out], data, np.diag(tot_sigma2s),
+                allow_singular=True)
+
+        # TODO: remove this here
+        self.Likelihoods = likelihoods
+
+        return likelihoods
+
+    # -------------------------------------------------------------------------
+    def _corr_factor_BME(self, obs_data, total_sigma2s, logBME):
+        """
+        Calculates the correction factor for BMEs.
+        """
+        MetaModel = self.MetaModel
+        samples = self.ExpDesign.X  # valid_samples
+        model_outputs = self.ExpDesign.Y  # valid_model_runs
+        n_samples = samples.shape[0]
+
+        # Extract the requested model outputs for likelihood calulation
+        output_names = self.out_names
+
+        # TODO: Evaluate MetaModel on the experimental design and ValidSet
+        OutputRS, stdOutputRS = MetaModel.eval_metamodel(samples=samples)
+
+        logLik_data = np.zeros(n_samples)
+        logLik_model = np.zeros(n_samples)
+        # Loop over the outputs
+        for idx, out in enumerate(output_names):
+
+            # (Meta)Model Output
+            nsamples, nout = model_outputs[out].shape
+
+            # Prepare data and remove NaN
+            try:
+                data = obs_data[out].values[~np.isnan(obs_data[out])]
+            except AttributeError:
+                data = obs_data[out][~np.isnan(obs_data[out])]
+
+            # Prepare sigma2s
+            non_nan_indices = ~np.isnan(total_sigma2s[out])
+            tot_sigma2s = total_sigma2s[out][non_nan_indices][:nout]
+
+            # Covariance Matrix
+            covMatrix_data = np.diag(tot_sigma2s)
+
+            for i, sample in enumerate(samples):
+                # Simulation run
+                y_m = model_outputs[out][i]
+
+                # Surrogate prediction
+                y_m_hat = OutputRS[out][i]
+
+                # CovMatrix with the surrogate error
+                # covMatrix = np.diag(stdOutputRS[out][i]**2)
+                # covMatrix = np.diag((y_m - y_m_hat) ** 2)
+                covMatrix = np.diag(
+                    np.mean((model_outputs[out] - OutputRS[out]), axis=0) ** 2
+                )
+
+                # Compute likelilhood output vs data
+                logLik_data[i] += logpdf(
+                    y_m_hat, data, covMatrix_data
+                )
+
+                # Compute likelilhood output vs surrogate
+                logLik_model[i] += logpdf(y_m_hat, y_m, covMatrix)
+
+        # Weight
+        logLik_data -= logBME
+        weights = np.exp(logLik_model + logLik_data)
+
+        return np.log(np.mean(weights))
+
+    # -------------------------------------------------------------------------
+    def _posteriorPlot(self, posterior, par_names, key):
+        """
+        Plot the posterior of a specific key as a corner plot
+
+        Parameters
+        ----------
+        posterior : 2d np.array
+            Samples of the posterior.
+        par_names : list of strings
+            List of the parameter names.
+        key : string
+            Output key that this posterior belongs to.
+
+        Returns
+        -------
+        figPosterior : corner.corner
+            Plot of the posterior.
+
+        """
+
+        # Initialization
+        newpath = r'Outputs_SeqPosteriorComparison/posterior'
+        os.makedirs(newpath, exist_ok=True)
+
+        bound_tuples = self.ExpDesign.bound_tuples
+        n_params = len(par_names)
+        font_size = 40
+        if n_params == 2:
+
+            figPosterior, ax = plt.subplots(figsize=(15, 15))
+
+            sns.kdeplot(x=posterior[:, 0], y=posterior[:, 1],
+                        fill=True, ax=ax, cmap=plt.cm.jet,
+                        clip=bound_tuples)
+            # Axis labels
+            plt.xlabel(par_names[0], fontsize=font_size)
+            plt.ylabel(par_names[1], fontsize=font_size)
+
+            # Set axis limit
+            plt.xlim(bound_tuples[0])
+            plt.ylim(bound_tuples[1])
+
+            # Increase font size
+            plt.xticks(fontsize=font_size)
+            plt.yticks(fontsize=font_size)
+
+            # Switch off the grids
+            plt.grid(False)
+
+        else:
+            import corner
+            figPosterior = corner.corner(posterior, labels=par_names,
+                                         title_fmt='.2e', show_titles=True,
+                                         title_kwargs={"fontsize": 12})
+
+        figPosterior.savefig(f'./{newpath}/{key}.pdf', bbox_inches='tight')
+        plt.close()
+
+        # Save the posterior as .npy
+        np.save(f'./{newpath}/{key}.npy', posterior)
+
+        return figPosterior
+
+    # -------------------------------------------------------------------------
+    def _BME_Calculator(self, obs_data, sigma2Dict, rmse=None):
+        """
+        This function computes the Bayesian model evidence (BME) via Monte
+        Carlo integration.
+
+        Parameters
+        ----------
+        obs_data : dict of 1d np arrays
+            Observed data.
+        sigma2Dict : pandas dataframe, matches obs_data
+            Estimated uncertainty for the observed data.
+        rmse : dict of floats, optional
+            RMSE values for each output-key. The dafault is None.
+
+        Returns
+        -------
+        (logBME, KLD, X_Posterior, Likelihoods, distHellinger)
+        
+        """
+        # Initializations
+        # TODO: this just does not make sense, recheck from old commits
+        if self.valid_likelihoods is not None:
+            valid_likelihoods = self.valid_likelihoods
+        else:
+            valid_likelihoods = []
+        valid_likelihoods = np.array(valid_likelihoods)
+
+        post_snapshot = self.ExpDesign.post_snapshot
+        if post_snapshot or valid_likelihoods.shape[0] != 0:
+            newpath = r'Outputs_SeqPosteriorComparison/likelihood_vs_ref'
+            os.makedirs(newpath, exist_ok=True)
+
+        SamplingMethod = 'random'
+        MCsize = 10000
+        ESS = 0
+
+        # Estimation of the integral via Monte Varlo integration
+        while (ESS > MCsize) or (ESS < 1):
+
+            # Generate samples for Monte Carlo simulation
+            X_MC = self.ExpDesign.generate_samples(
+                MCsize, SamplingMethod
+            )
+
+            # Monte Carlo simulation for the candidate design
+            Y_MC, std_MC = self.MetaModel.eval_metamodel(samples=X_MC)
+
+            # Likelihood computation (Comparison of data and
+            # simulation results via PCE with candidate design)
+            Likelihoods = self._normpdf(
+                Y_MC, std_MC, obs_data, sigma2Dict, rmse
+            )
+
+            # Check the Effective Sample Size (1000<ESS<MCsize)
+            ESS = 1 / np.sum(np.square(Likelihoods / np.sum(Likelihoods)))
+
+            # Enlarge sample size if it doesn't fulfill the criteria
+            if (ESS > MCsize) or (ESS < 1):
+                print(f'ESS={ESS} MC size should be larger.')
+                MCsize *= 10
+                ESS = 0
+
+        # Rejection Step
+        # Random numbers between 0 and 1
+        unif = np.random.rand(1, MCsize)[0]
+
+        # Reject the poorly performed prior
+        accepted = (Likelihoods / np.max(Likelihoods)) >= unif
+        X_Posterior = X_MC[accepted]
+
+        # ------------------------------------------------------------
+        # --- Kullback-Leibler Divergence & Information Entropy ------
+        # ------------------------------------------------------------
+        # Prior-based estimation of BME
+        logBME = np.log(np.nanmean(Likelihoods))
+
+        # TODO: Correction factor
+        # log_weight = self.__corr_factor_BME(obs_data, sigma2Dict, logBME)
+
+        # Posterior-based expectation of likelihoods
+        postExpLikelihoods = np.mean(np.log(Likelihoods[accepted]))
+
+        # Posterior-based expectation of prior densities
+        # TODO: this is commented out, as it is not used again
+        # postExpPrior = np.mean(
+        #     np.log(self.ExpDesign.JDist.pdf(X_Posterior.T))
+        # )
+
+        # Calculate Kullback-Leibler Divergence
+        # KLD = np.mean(np.log(Likelihoods[Likelihoods!=0])- logBME)
+        KLD = postExpLikelihoods - logBME
+
+        # Information Entropy based on Entropy paper Eq. 38
+        # infEntropy = logBME - postExpPrior - postExpLikelihoods
+
+        # If post_snapshot is True, plot likelihood vs refrence
+        if post_snapshot or valid_likelihoods:
+            # Hellinger distance
+            valid_likelihoods = np.array(valid_likelihoods)
+            ref_like = np.log(valid_likelihoods[(valid_likelihoods > 0)])
+            est_like = np.log(Likelihoods[Likelihoods > 0])
+            distHellinger = hellinger_distance(ref_like, est_like)
+
+            idx = len([name for name in os.listdir(newpath) if 'Likelihoods_'
+                       in name and os.path.isfile(os.path.join(newpath, name))])
+
+            fig, ax = plt.subplots()
+            try:
+                sns.kdeplot(np.log(valid_likelihoods[valid_likelihoods > 0]),
+                            shade=True, color="g", label='Ref. Likelihood')
+                sns.kdeplot(np.log(Likelihoods[Likelihoods > 0]), shade=True,
+                            color="b", label='Likelihood with PCE')
+            except:
+                pass
+
+            text = f"Hellinger Dist.={distHellinger:.3f}\n logBME={logBME:.3f}"
+            "\n DKL={KLD:.3f}"
+
+            plt.text(0.05, 0.75, text, bbox=dict(facecolor='wheat',
+                                                 edgecolor='black',
+                                                 boxstyle='round,pad=1'),
+                     transform=ax.transAxes)
+
+            fig.savefig(f'./{newpath}/Likelihoods_{idx}.pdf',
+                        bbox_inches='tight')
+            plt.close()
+
+        else:
+            distHellinger = 0.0
+
+        # Bayesian inference with Emulator only for 2D problem
+        if post_snapshot and self.MetaModel.n_params == 2 and not idx % 5:
+            BayesOpts = BayesInference(self)
+
+            BayesOpts.emulator = True
+            BayesOpts.plot_post_pred = False
+
+            # Select the inference method
+            import emcee
+            BayesOpts.inference_method = "MCMC"
+            # Set the MCMC parameters passed to self.mcmc_params
+            BayesOpts.mcmc_params = {
+                'n_steps': 1e5,
+                'n_walkers': 30,
+                'moves': emcee.moves.KDEMove(),
+                'verbose': False
+            }
+
+            # ----- Define the discrepancy model -------
+            # TODO: check with Farid if this first line is how it should be
+            BayesOpts.measured_data = obs_data
+            obs_data = pd.DataFrame(obs_data, columns=self.out_names)
+            BayesOpts.measurement_error = obs_data
+            # TODO: shouldn't the uncertainty be sigma2Dict instead of obs_data?
+
+            # # -- (Option B) --
+            DiscrepancyOpts = Discrepancy('')
+            DiscrepancyOpts.type = 'Gaussian'
+            DiscrepancyOpts.parameters = obs_data ** 2
+            BayesOpts.Discrepancy = DiscrepancyOpts
+            # Start the calibration/inference
+            Bayes_PCE = BayesOpts.create_inference()
+            X_Posterior = Bayes_PCE.posterior_df.values
+
+        return logBME, KLD, X_Posterior, Likelihoods, distHellinger
+
+    # -------------------------------------------------------------------------
+    def _validError(self):
+        """
+        Evaluate the metamodel on the validation samples and calculate the
+        error against the corresponding model runs
+
+        Returns
+        -------
+        rms_error : dict
+            RMSE for each validation run.
+        valid_error : dict
+            Normed (?)RMSE for each validation run.
+
+        """
+        # Extract the original model with the generated samples
+        valid_model_runs = self.ExpDesign.valid_model_runs
+
+        # Run the PCE model with the generated samples
+        valid_PCE_runs, _ = self.MetaModel.eval_metamodel(samples=self.ExpDesign.valid_samples)
+
+        rms_error = {}
+        valid_error = {}
+        # Loop over the keys and compute RMSE error.
+        for key in self.out_names:
+            rms_error[key] = mean_squared_error(
+                valid_model_runs[key], valid_PCE_runs[key],
+                multioutput='raw_values',
+                sample_weight=None,
+                squared=False)
+            # Validation error
+            valid_error[key] = (rms_error[key] ** 2)
+            valid_error[key] /= np.var(valid_model_runs[key], ddof=1, axis=0)
+
+            # Print a report table
+            print("\n>>>>> Updated Errors of {} <<<<<".format(key))
+            print("\nIndex  |  RMSE   |  Validation Error")
+            print('-' * 35)
+            print('\n'.join(f'{i + 1}  |  {k:.3e}  |  {j:.3e}' for i, (k, j)
+                            in enumerate(zip(rms_error[key],
+                                             valid_error[key]))))
+
+        return rms_error, valid_error
+
+    # -------------------------------------------------------------------------
+    def _error_Mean_Std(self):
+        """
+        Calculates the error in the overall mean and std approximation of the
+        surrogate against the mc-reference provided to the model.
+        This can only be applied to metamodels of polynomial type
+
+        Returns
+        -------
+        RMSE_Mean : float
+            RMSE of the means 
+        RMSE_std : float
+            RMSE of the standard deviations
+
+        """
+        # Compute the mean and std based on the MetaModel
+        pce_means, pce_stds = self.MetaModel._compute_pce_moments()
+
+        # Compute the root mean squared error
+        for output in self.out_names:
+            # Compute the error between mean and std of MetaModel and OrigModel
+            RMSE_Mean = mean_squared_error(
+                self.Model.mc_reference['mean'], pce_means[output], squared=False
+            )
+            RMSE_std = mean_squared_error(
+                self.Model.mc_reference['std'], pce_stds[output], squared=False
+            )
+
+        return RMSE_Mean, RMSE_std
-- 
GitLab