Skip to content

Instantly share code, notes, and snippets.

@cqfd
Created June 5, 2018 00:31
Show Gist options
  • Save cqfd/0ecd57d40fed435c5fbd5156f46855a6 to your computer and use it in GitHub Desktop.
Save cqfd/0ecd57d40fed435c5fbd5156f46855a6 to your computer and use it in GitHub Desktop.
// From Distribution.scala
def gamma(z: Real): Real = {
val w = (z + 1) + (Real.one / ((12 * (z + 1)) - (Real.one / (10 * (z + 1)))))
(Real(Math.PI * 2).log / 2) - ((z + 1).log / 2) + ((z + 1) * (w.log - 1)) - z.log
}
def main(args: Array[String]): Unit = {
val _ =
SBC(Uniform(0.5, 1)) { x =>
Beta(x, x)
}.prepare(HMC(5), 1000, 1000)
.animate(3)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment