dotnet / infer

Infer.NET is a framework for running Bayesian inference in graphical models
https://dotnet.github.io/infer/
MIT License
1.56k stars 230 forks source link

Minor question: where are the formulas related to additive corrections for TruncatedGaussian? #397

Closed j2kun closed 2 years ago

j2kun commented 2 years ago

Hi there, I'm new to this and just learning by reading some papers and comparing the code. I see equations 4.4-4.5 from Herbrich 05 and I'm trying to locate similar methods, but I don't see it in TruncatedGaussian.cs.

Could you kindly point me to where to look for this? Or is it disguised somehow else?

tminka commented 2 years ago

TruncatedGaussian.GetMeanAndVariance

j2kun commented 2 years ago

I found that, but then it leads to this 300-line section. It appears to be representing the truncated Gaussian in a generalized form, and it's so formula dense I'm not sure (a) how this exactly relates to the truncated Gaussian, nor (b) what parts of that correspond to the additive correction formulas in the paper, or if that's even the right way to think about it...

tminka commented 2 years ago

That code does correspond to the formulas in the paper. The reason it is complex is because it needs to work around the limited precision of floating-point numbers in C#.

j2kun commented 2 years ago

Thanks!