From 158573305bb66b615f96cf490dceb23e0a995429 Mon Sep 17 00:00:00 2001 From: Farid Mohammadi <farid.mohammadi@iws.uni-stuttgart.de> Date: Mon, 16 May 2022 17:45:33 +0200 Subject: [PATCH] [surrogate][sequential] fix bugs. --- .../post_processing/post_processing.py | 18 +++++++++--------- .../surrogate_models/sequential_design.py | 5 ----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/bayesvalidrox/post_processing/post_processing.py b/src/bayesvalidrox/post_processing/post_processing.py index fcb51945f..5110af0b3 100644 --- a/src/bayesvalidrox/post_processing/post_processing.py +++ b/src/bayesvalidrox/post_processing/post_processing.py @@ -334,14 +334,14 @@ class PostProcessing: # Extract the values from dict sorted_seq_opt = {} # Number of replications - n_reps = PCEModel.ExpDesign.nReprications + n_reps = PCEModel.ExpDesign.n_replication # Get the list of utility function names # Handle if only one UtilityFunction is provided - if not isinstance(PCEModel.ExpDesign.UtilityFunction, list): - util_funcs = [PCEModel.ExpDesign.UtilityFunction] + if not isinstance(PCEModel.ExpDesign.util_func, list): + util_funcs = [PCEModel.ExpDesign.util_func] else: - util_funcs = PCEModel.ExpDesign.UtilityFunction + util_funcs = PCEModel.ExpDesign.util_func for util in util_funcs: sortedSeq = {} @@ -393,12 +393,12 @@ class PostProcessing: if ref_BME_KLD is not None: if plot == 'BME': refValue = ref_BME_KLD[0] - plot_label = r'$BME/BME^{Ref.}$' + plot_label = r'BME/BME$^{Ref.}$' if plot == 'KLD': refValue = ref_BME_KLD[1] - plot_label = '$D_{KL}[p(\theta|y_*),p(\theta)]'\ - ' / D_{KL}^{Ref.}[p(\theta|y_*), '\ - 'p(\theta)]$' + plot_label = '$D_{KL}[p(\\theta|y_*),p(\\theta)]'\ + ' / D_{KL}^{Ref.}[p(\\theta|y_*), '\ + 'p(\\theta)]$' # Difference between BME/KLD and the ref. values all_errors = np.divide(all_errors, @@ -461,7 +461,7 @@ class PostProcessing: if ref_BME_KLD is not None: if plot == 'BME': refValue = ref_BME_KLD[0] - plot_label = r'$BME/BME^{Ref.}$' + plot_label = r'BME/BME$^{Ref.}$' if plot == 'KLD': refValue = ref_BME_KLD[1] plot_label = '$D_{KL}[p(\\theta|y_*),p(\\theta)]'\ diff --git a/src/bayesvalidrox/surrogate_models/sequential_design.py b/src/bayesvalidrox/surrogate_models/sequential_design.py index e7fc9261f..e1c6f4689 100644 --- a/src/bayesvalidrox/surrogate_models/sequential_design.py +++ b/src/bayesvalidrox/surrogate_models/sequential_design.py @@ -101,11 +101,6 @@ class SeqDesign(): # TotalSigma2 = np.empty((0, 1)) if len(obs_data) != 0 and hasattr(PCEModel, 'Discrepancy'): TotalSigma2 = PCEModel.Discrepancy.parameters - # # ------ Prepare diagonal enteries for co-variance matrix --------- - # for keyIdx, key in enumerate(Model.Output.names): - # # optSigma = 'B' - # sigma2 = np.array(PCEModel.Discrepancy.parameters[key]) - # TotalSigma2 = np.append(TotalSigma2, sigma2) # Calculate the initial BME out = self.__BME_Calculator(initPCEModel, obs_data, TotalSigma2) -- GitLab