From 708d354f183a464a621ff066cdeaca7ee2cff57a Mon Sep 17 00:00:00 2001
From: kohlhaasrebecca <rebecca.kohlhaas@outlook.com>
Date: Wed, 11 Dec 2024 21:24:04 +0100
Subject: [PATCH] Fix test

---
 .../post_processing/post_processing.py        | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/bayesvalidrox/post_processing/post_processing.py b/src/bayesvalidrox/post_processing/post_processing.py
index 3b33fd1e6..1ab736ec9 100644
--- a/src/bayesvalidrox/post_processing/post_processing.py
+++ b/src/bayesvalidrox/post_processing/post_processing.py
@@ -856,18 +856,14 @@ class PostProcessing:
             n_samples = samples.shape[0]
 
         # Evaluate the original and the surrogate model
-        if outputs is None:
-            y_val = self._eval_model(samples, key_str='valid')
-        else:
-            y_val = outputs
-        y_pce_val, _ = self.engine.eval_metamodel(samples=samples)
+        y_val = outputs
+        if y_val is None:
+            y_val, _ = self.engine.Model.run_model_parallel(samples, key_str="valid")
+        y_metamod_val, _ = self.engine.eval_metamodel(samples=samples)
 
         # Fit the data(train the model)
-        for key in y_pce_val.keys():
-
-            y_pce_val_ = y_pce_val[key]
-            y_val_ = y_val[key]
-            residuals = y_val_ - y_pce_val_
+        for key in y_metamod_val.keys():
+            residuals = y_val[key] - y_metamod_val[key]
 
             # ------ Residuals vs. predicting variables ------
             # Check the assumptions of linearity and independence
@@ -891,7 +887,8 @@ class PostProcessing:
 
             # ------ Fitted vs. residuals ------
             # Check the assumptions of linearity and independence
-            fig2 = plt.figure()
+            for i in range(y_metamod_val[key].shape[0]):
+                plt.scatter(x=y_metamod_val[key][i,:], y=residuals[i,:], color="blue", edgecolor="k")
             plt.title(f"{key}: Residuals vs. fitted values")
             plt.scatter(x=y_pce_val_, y=residuals, color='blue', edgecolor='k')
             plt.grid(True)
-- 
GitLab