Samplers
Samplers and related classes are found in com.stripe.rainier.sampler.
SamplerConfig
Calls to sample() can optionally provide a custom configuration object that implements the following trait:
trait SamplerConfig {
  def iterations: Int
  def warmupIterations: Int
  def statsWindow: Int
  def stepSizeTuner(): StepSizeTuner
  def massMatrixTuner(): MassMatrixTuner
  def sampler(): Sampler
}
Your configuration can directly implement every method of this trait, or extend DefaultConfiguration and selectively override.
iterationsis the number of samples per chain to keep, after the warmup period (default: 1000)warmupIterationsis the number of samples per chain to use for warmup (default: 1000)statsWindowis the number of training samples to keep for diagnostics like average acceptance rate (default: 100)stepSizeTuner()should create a newStepSizeTunerobject. This can be:new DualAvgTuner(targetAcceptRate)(the default is this with 0.8)StaticStepSize(stepSize)
massMatrixTuner()should create a newMassMatrixTunerobject. This can be:new IdentityMassMatrixnew DiagonalMassMatrixTuner(initialWindowSize, windowExpansion, skipFirst, skipLast)(the default isnew DiagonalMassMatrixTuner(50, 1.5, 50, 50))new DenseMassMatrixTuner(initialWindowSize, windowExpansion, skipFirst, skipLast)
sampler()should create a newSamplerobject. This can be:new HMCSampler(nSteps)new EHMCSampler(maxSteps, minSteps)(the default isnew EHMCSampler(1024, 1))
For backwards compatibility with 0.3.0, you can also build configs using the old HMC and EHMC constructors below.
HMC
Hamiltonian Monte Carlo with dual averaging as per Gelman & Hoffman
HMC(warmupIterations: Int, iterations: Int, nSteps: Int)
warmupIterationsare used to find the best step sizeiterationsproduce usable samplesnStepsis the number of leap-frog steps used for integration
EHMC
Empirical HMC as per Wu et al
EHMC(warmupIterations: Int, iterations: Int, l0: Int = 10, k: Int = 1000)
warmupIterationsare used to find the best step sizeiterationsproduce usable sampleskis the number of iterations used to build an empirical distribution of steps to U-turnl0is the number of leap-frog steps used during this empirical phase