From e6458866cbf3f1fa4265500a2a781b144c40612f Mon Sep 17 00:00:00 2001
From: Farid Mohammadi <farid.mohammadi@iws.uni-stuttgart.de>
Date: Fri, 17 Jun 2022 18:23:31 +0200
Subject: [PATCH] [examples][pollution] uncomment save object via joblib.

---
 examples/pollution/test_valid_pollution.py | 24 +++++++++++-----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/examples/pollution/test_valid_pollution.py b/examples/pollution/test_valid_pollution.py
index f4a03957a..1deea2f29 100644
--- a/examples/pollution/test_valid_pollution.py
+++ b/examples/pollution/test_valid_pollution.py
@@ -147,15 +147,15 @@ if __name__ == "__main__":
 
     # >>>>>>>>>>>>>>>>>>>>>> Build Surrogate <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
     # Adaptive sparse arbitrary polynomial chaos expansion
-    # PCEModel = MetaModelOpts.create_metamodel(Model)
+    PCEModel = MetaModelOpts.create_metamodel(Model)
 
-    # # Save PCE models
-    # with open(f"PCEModel_{Model.name}.pkl", "wb") as output:
-    #     joblib.dump(PCEModel, output, 2)
+    # Save PCE models
+    with open(f"PCEModel_{Model.name}.pkl", "wb") as output:
+        joblib.dump(PCEModel, output, 2)
 
     # Load the objects
-    with open(f"PCEModel_{Model.name}.pkl", "rb") as input:
-        PCEModel = joblib.load(input)
+    # with open(f"PCEModel_{Model.name}.pkl", "rb") as input:
+    #     PCEModel = joblib.load(input)
 
     # =====================================================
     # =========  POST PROCESSING OF METAMODELS  ===========
@@ -209,15 +209,15 @@ if __name__ == "__main__":
     BayesOpts.Discrepancy = Discrepancy(DiscOutputOpts)
 
     # Start the inference
-    # BayesCalib = BayesOpts.create_inference()
+    BayesCalib = BayesOpts.create_inference()
 
-    # # Save class objects
-    # with open(f'Bayes_{Model.name}.pkl', 'wb') as output:
-    #     joblib.dump(BayesCalib, output, 2)
+    # Save class objects
+    with open(f'Bayes_{Model.name}.pkl', 'wb') as output:
+        joblib.dump(BayesCalib, output, 2)
 
     # Load the objects
-    with open(f"Bayes_{Model.name}.pkl", "rb") as input:
-        BayesCalib = joblib.load(input)
+    # with open(f"Bayes_{Model.name}.pkl", "rb") as input:
+    #     BayesCalib = joblib.load(input)
 
     # =====================================================
     # ===========  BAYESIAN MODEL VALIDATION ==============
-- 
GitLab