Skip to content
Snippets Groups Projects
Commit 239b22f1 authored by faridm69's avatar faridm69
Browse files

[BayesInference][MCMC] min and max will be respected if the intial samples are provided.

parent e40a024d
No related branches found
No related tags found
No related merge requests found
...@@ -56,12 +56,17 @@ class MCMC(): ...@@ -56,12 +56,17 @@ class MCMC():
# when aPCE selected - gaussian kernel distribution # when aPCE selected - gaussian kernel distribution
initsamples = priorDist.resample(self.nwalkers).T initsamples = priorDist.resample(self.nwalkers).T
else: 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)) initsamples = np.zeros((self.nwalkers, ndim))
BoundTuples = []
for idxDim in range(ndim): for idxDim in range(ndim):
lower, upper = np.min(self.initsamples[:,idxDim]),np.max(self.initsamples[:,idxDim]) 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) 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)) print("\n>>>> Bayesian inference with MCMC for {0} started. <<<<<<".format(self.BayesOpts.Name))
if self.mp: if self.mp:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment