Skip to content

Instantly share code, notes, and snippets.

@kailuowang
Last active October 3, 2018 14:31
Show Gist options
  • Save kailuowang/a210a3130b7c6408641cc88af9e547ed to your computer and use it in GitHub Desktop.
Save kailuowang/a210a3130b7c6408641cc88af9e547ed to your computer and use it in GitHub Desktop.
import com.stripe.rainier.repl._
import com.stripe.rainier.core._
val data = Gamma(0.5, 3).param.sample()
val ap = for {
a <- Normal(0.5, 0.05).param
b <- Normal(3, 0.1).param
d <- Gamma(a, b).fit(data)
} yield a
ap.sample() // took forever.
@kailuowang
Copy link
Author

kailuowang commented Oct 2, 2018

This is on 0.1.3. Also it is probably more general than this particular case, I think I had the same issue with a LogNormal distribution.

@kailuowang
Copy link
Author

import com.stripe.rainier.repl._
import com.stripe.rainier.core._
import com.stripe.rainier.sampler._

val data = Gamma(0.5, 3).param.sample().take(5000)
val ap = for {
        a <- Normal(0.5, 0.05).param
        b <- Normal(3, 0.1).param
        d <- Gamma(a, b).fit(data)
   } yield a

ap.sample(HMC(5), 1000, 1000) // 35 seconds
ap.sample(Walkers(100), 1000, 1000) // 2 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment