From 239b22f1729be3807cf3b90a3a06ed4cacd24c3e Mon Sep 17 00:00:00 2001 From: faridm69 <faridmohammadi69@gmail.com> Date: Thu, 6 Aug 2020 14:45:43 +0200 Subject: [PATCH] [BayesInference][MCMC] min and max will be respected if the intial samples are provided. --- BayesValidRox/BayesInference/MCMC.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/BayesValidRox/BayesInference/MCMC.py b/BayesValidRox/BayesInference/MCMC.py index 1055b7f9e..a3bf07842 100755 --- a/BayesValidRox/BayesInference/MCMC.py +++ b/BayesValidRox/BayesInference/MCMC.py @@ -56,12 +56,17 @@ class MCMC(): # when aPCE selected - gaussian kernel distribution initsamples = priorDist.resample(self.nwalkers).T else: - # Pick samples based on a uniform dist between main and max of each dim + # Pick samples based on a uniform dist between min and max of each dim initsamples = np.zeros((self.nwalkers, ndim)) + BoundTuples = [] for idxDim in range(ndim): lower, upper = np.min(self.initsamples[:,idxDim]),np.max(self.initsamples[:,idxDim]) + BoundTuples.append((lower, upper)) initsamples[:,idxDim] = st.uniform(loc=lower, scale=upper-lower).rvs(size=self.nwalkers) - + + # Update lower and upper + PCEModel.ExpDesign.BoundTuples = BoundTuples + print("\n>>>> Bayesian inference with MCMC for {0} started. <<<<<<".format(self.BayesOpts.Name)) if self.mp: -- GitLab