Skip to content

An efficient sampler of Polya-Gamma distribution in pure Java.

License

Notifications You must be signed in to change notification settings

ymdpharm/polya-gamma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

polya-gamma

pgb0 pg1c

An efficient sampler of Polya-Gamma distribution in pure Java.

It is also compatible to other distributions of Apache Commons Math3.

Example

// use default sampler
PolyaGammaDistribution pg1 = new PolyaGammaDistribution(2, 4);
double x = pg1.sample(); 
double mean = pg1.getNumericalMean();
double vari = pg1.getNumericalVariance();

// select sampler explicitly
PolyaGammaDistribution pg2 = new PolyaGammaDistribution(2, 4, PolyaGammaDistribution.AvailableSampler.Gaussian);

Samplers

  • Wrapper (default)
  • SumGamma approx
  • Gaussian approx
  • Saddle Point approx (WIP)

refs

  • Polson, Nicholas G., James G. Scott, and Jesse Windle. "Bayesian inference for logistic models using Pólya–Gamma latent variables." Journal of the American statistical Association (2013)
  • J. Windle, N. G. Polson, and J. G. Scott. "Improved Polya-gamma sampling". Technical Report, University of Texas at Austin (2013)

About

An efficient sampler of Polya-Gamma distribution in pure Java.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages