diff --git a/BayesValidRox/BayesInference/BayesInference.py b/BayesValidRox/BayesInference/BayesInference.py index f48f67a5ef9a72ddd71bef14dd65659fa3091d73..ebbdd80f9719c3a9bef9026c5648cc58b28775f1 100644 --- a/BayesValidRox/BayesInference/BayesInference.py +++ b/BayesValidRox/BayesInference/BayesInference.py @@ -258,7 +258,7 @@ class BayesInference: NrofBayesSamples = self.NrofSamples # Evaluate PCEModel on the experimental design Samples = PCEModel.ExpDesign.X - OutputRS, stdOutputRS = PCEModel.eval_metamodel(samples=Samples) + OutputRS, stdOutputRS = PCEModel.eval_metamodel(samples=Samples,name=self.Name) # Reset the NrofSamples to NrofBayesSamples self.NrofSamples = NrofBayesSamples @@ -415,7 +415,7 @@ class BayesInference: # Prior predictive if self.emulator: PriorPred = self.meanPCEPriorPred - PosteriorPred, _ = PCEModel.eval_metamodel(samples=Posterior_df.to_numpy()) + PosteriorPred, _ = PCEModel.eval_metamodel(samples=Posterior_df.to_numpy(),name=self.Name) else: PriorPred = self.ModelPriorPred PosteriorPred = self.eval_Model(Samples=Posterior_df.to_numpy()) @@ -559,7 +559,7 @@ class BayesInference: # ---------------- Likelihood calculation ---------------- if self.emulator: # Evaluate the PCEModel - self.meanPCEPriorPred, self.stdPCEPriorPred = PCEModel.eval_metamodel(samples=self.Samples) + self.meanPCEPriorPred, self.stdPCEPriorPred = PCEModel.eval_metamodel(samples=self.Samples,name=self.Name) # unknown sigma2 if optSigma == 'C': @@ -622,7 +622,7 @@ class BayesInference: if self.PlotPostPred: # Run the models for MAP # PCEModel - MAP_PCEModel, MAP_PCEModelstd = PCEModel.eval_metamodel(samples=MAP_theta) + MAP_PCEModel, MAP_PCEModelstd = PCEModel.eval_metamodel(samples=MAP_theta,name=self.Name) self.MAPpceModelMean = MAP_PCEModel self.MAPpceModelStd = MAP_PCEModelstd diff --git a/BayesValidRox/PostProcessing/PostProcessing.py b/BayesValidRox/PostProcessing/PostProcessing.py index 3fa0d9ac45770c911aa4ec039dd5c1a962a0d80e..109c1ff9322392e44df9743ca137abe082eabc9f 100644 --- a/BayesValidRox/PostProcessing/PostProcessing.py +++ b/BayesValidRox/PostProcessing/PostProcessing.py @@ -272,7 +272,7 @@ class PostProcessing: Samples = self.get_Sample() self.eval_Model(Samples) - self.PCEOutputs, self.PCEOutputs_std = metaModel.eval_metamodel(samples=Samples) + self.PCEOutputs, self.PCEOutputs_std = metaModel.eval_metamodel(samples=Samples,name=self.Name) if self.plotFlag == True: try: diff --git a/BayesValidRox/surrogate_models/surrogate_models.py b/BayesValidRox/surrogate_models/surrogate_models.py index 56b7ff91d617d8d1d547ed51b8608e2328822cfb..d13ec4b6794ff3566b32c79f0c326e151a45003f 100644 --- a/BayesValidRox/surrogate_models/surrogate_models.py +++ b/BayesValidRox/surrogate_models/surrogate_models.py @@ -2003,7 +2003,7 @@ class Metamodel: return Xnew #-------------------------------------------------------------------------------------------------------- - def eval_metamodel(self,samples=None, nsamples=None, samplingMethod='random', return_samples=False): + def eval_metamodel(self,samples=None, nsamples=None, samplingMethod='random', name='Calib', return_samples=False): ModelDict = self.gp_poly if self.metaModel.lower() == 'gpe' else self.CoeffsDict @@ -2071,7 +2071,7 @@ class Metamodel: stdPCEOutputs[Outkey] = PCEOutputs_std else: index = self.index - if self.Name.lower() == 'calib': + if name.lower() == 'calib': if self.DimRedMethod.lower() == 'pca': PCA = self.pca[Outkey] meanPCEOutputs[Outkey] = PCA.mean_[:index] + np.dot(PCEOutputs_mean,PCA.components_)[:,:index]