eggplantbren / DNest4

Diffusive Nested Sampling
MIT License
60 stars 21 forks source link

gaussian.py discrepancy between theory and simulated result #37

Open qacwnfq opened 2 years ago

qacwnfq commented 2 years ago

Hey,

I was just running the gaussian.py example locally and I found

log(Z) = -14.94080654452895 [exact log(Z) = -11.512928331486771]

Is this discrepancy between the sampled and theoretical result expected?

I've appended the .txt files that are created during sampling to this issue.

Thanks!

levels.txt sample.txt sample_info.txt sample_log_X.txt sampler_state.txt stats.txt weights.txt

qacwnfq commented 2 years ago

One thing I noticed in the prior is, that it is is not sampling symmetrically around 0. Right now it is like this:

def from_prior(self):
        return np.random.uniform(-0.5*self.width, self.width,
                                    size=(self.ndim,))

I think it is meant to be like this:

 def from_prior(self):
        return np.random.uniform(-0.5*self.width, 0.5*self.width,
                                    size=(self.ndim,))

But that doesn't fix the issue.

qacwnfq commented 2 years ago

So if i check the posteriors for the C++ version of this example (PR #38) I get: image

which is quite different from image

There are some clear visible differences. I will try to investigate if they arise within the gaussian.py file.

eggplantbren commented 2 years ago

Thanks for looking into it. I'm very occupied at the momentSent from my Galaxy -------- Original message --------From: Johann Fredrik Jadebeck @.> Date: 31/08/21 00:15 (GMT+12:00) To: eggplantbren/DNest4 @.> Cc: Subscribed @.***> Subject: Re: [eggplantbren/DNest4] gaussian.py discrepancy between theory and simulated result (#37) So if i check the posteriors for the C++ version of this example (PR #38) I get:

which is quite different from

There are some clear visible differences. I will try to investigate if they arise within the gaussian.py file.

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.

qacwnfq commented 2 years ago

So in the C++-Version it seems to get close enough to the analytical solution. For now I will continue with the C++-Version :)