Packages

  • package root
    Definition Classes
    root
  • package mgo
    Definition Classes
    root
  • package abc

    Approximate Bayesian computation (ABC) methods are used to draw samples approximating a posterior distribution p(θ|y) ∝ p(y|θ) p(θ) when the value of the likelihood p(y|θ) is unavailable but one can sample according to the likelihood, typically via simulation.

    Approximate Bayesian computation (ABC) methods are used to draw samples approximating a posterior distribution p(θ|y) ∝ p(y|θ) p(θ) when the value of the likelihood p(y|θ) is unavailable but one can sample according to the likelihood, typically via simulation.

    Definition Classes
    mgo
  • object MonAPMC

    Parallel ABC algorithm based on APMC by Lenormand, Jabot and Deffuant (2012).

    Parallel ABC algorithm based on APMC by Lenormand, Jabot and Deffuant (2012). MonAPMC stands for "Monoid APMC".

    Given a stochastic function f: Vector[Double] => Vector[Double], and a value y: Vector[Double], the algorithm aims at finding what input vectors xs are likely to have resulted in the vector y through f. The objective is to estimate the probability distribution P(X|Y = y), where X represent f's input values, and Y its output values. The algorithm returns a sample of vectors that are distributed according to this distribution.

    The simplest way to run the algorithm is to use the MonAPMC.run and MonAPMC.scan functions. The first returns the final algorithm state, and the second the sequence of states corresponding to the successive steps of the alorithm. The posterior sample is in the final state s: s.thetas contains the particles, and s.weights their weights. For example, the expected value of the particle according to the posterior is the weighted average of the particles.

    **Controlling the function f evaluation:** During its course, the algorithm evaluates the user-provided function f many times. It can be useful to gain control of the function evaluation. For this purpose, use the ExposedEval object returned by MonAPMC.exposedStep. Its members, ExposedEval.pre and ExposedEval.post decompose the computation around the function evaluation. ExposedEval.pre returns an intermediate state and a org.apache.commons.math3.linear.RealMatrix: (pass, xs). The rows of the matrix xs are the input vectors with which to evaluate the function f. It is up to you to use these values to construct a new matrix, ys, such that its rows are the output values of f with the corresponding row in xs. The row order must be kept. Then, give (pass, ys) back to ExposedEval.post to get the new algorithm state, and reiterate. For example, to run the algorithm sequentially until it stops:

    def f(x: Array[Double]): Array[Double] = ...
    
    val step = MonAPMC.exposedStep(p)
    
    var state = MonAPMC.Empty()
    while (!MonAPMC.stop(p, state) {
      (pass, xs) = step.pre(state)
      ys = f(xs)
      state = step.post(pass, ys)
    }

    To run the algorithm in parallel, use the functions MonAPMC.split to split a current algorithm state into 2, such that the algorithm can be continued in parallel. You can step over the two in parallel for as many steps as you like, and merge them back together with MonAPMC.append.

    val s0 = MonAPMC.Empty()
    val (s0a, s0b) = MonAPMC.split(s0)
    val s1a = MonAPMC.step(s0a)
    val s2b = MonAPMC.step(MonAPMC.step(s0b))
    val s3 = MonAPMC.append(s1a, s2b)

    You can split states recursively as many times as you like to run more than 2 parallel threads:

    var (s1,s2) = MonAPMC.split(MonAPMC.Empty())
    var (s3,s4) = MonAPMC.split(s2)
    /* step over all 4 states */
    s = MonAPMC.append(s1,MonAPMC.append(s2,MonAPMC.append(s3, s4))),
    Definition Classes
    abc
  • Empty
  • MonState
  • Params
  • State

case class Params(apmcP: APMC.Params, stopSampleSizeFactor: Int) extends Product with Serializable

Parameters for MonAPMC.

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Params
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Params(apmcP: APMC.Params, stopSampleSizeFactor: Int)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val apmcP: APMC.Params
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  9. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  10. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  12. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  13. def productElementNames: Iterator[String]
    Definition Classes
    Product
  14. val stopSampleSizeFactor: Int
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  17. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped