Packages

abstract class ParSampler extends BaseProbQuerySampler[Reference] with ParSamplingAlgorithm

Parallel version of a sampling algorithm. Has a parallel collection of algorithm instances that will do its work on separate threads, over separate universes. Uses Scala's parallel collections to divide up the work, so it will work best if told to run on a number of threads less than or equal to the number of worker threads Scala creates when operating over parallel collections.

This creates two major differences with how a user interacts with the algorithm. First of all, rather than defining a model on a universe and then starting the algorithm, the user must define a function that generates a universe and applies any evidence, and then pass that to the companion object to create the algorithm. The second major difference is that elements must be referred to using references, since each variable will exist as multiple elements across the different universes.

One-time sampling will be faster, since it divides the work over the different threads. Anytime sampling should provide more accurate results, since it can take more samples over the same amount of time. Both cases will most likely require more memory, at least using the current implementation of WeightedSampler, which keeps track of all values and weights that have been sampled. When querying, a weighted combination of the results of the various threads is returned. This last step adds some overhead, which should be negligible as long as you are taking a large number of samples.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ParSampler
  2. ParSamplingAlgorithm
  3. BaseProbQuerySampler
  4. BaseProbQueryAlgorithm
  5. Algorithm
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ParSampler(algs: Seq[ProbQuerySampler], targets: Reference[_]*)

Type Members

  1. class NotATargetException [T] extends AlgorithmException
    Definition Classes
    BaseProbQueryAlgorithm

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 active: Boolean
    Attributes
    protected
    Definition Classes
    Algorithm
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def check[T](target: Reference[T]): Unit
    Attributes
    protected
    Definition Classes
    BaseProbQueryAlgorithm
  7. def cleanUp(): Unit

    Calls cleanUp() on all algorithms.

    Calls cleanUp() on all algorithms.

    Definition Classes
    ParSamplingAlgorithmAlgorithm
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def computeDistribution[T](target: Reference[T]): Stream[(Double, T)]

    Return an estimate of the expectation of the function under the marginal probability distribution of the target.

    Return an estimate of the expectation of the function under the marginal probability distribution of the target.

    Definition Classes
    BaseProbQuerySamplerBaseProbQueryAlgorithm
  10. def computeExpectation[T](target: Reference[T], function: (T) ⇒ Double): Double

    Return an estimate of the expectation of the function under the marginal probability distribution of the target.

    Return an estimate of the expectation of the function under the marginal probability distribution of the target.

    Definition Classes
    BaseProbQuerySamplerBaseProbQueryAlgorithm
  11. def computeProbability[T](target: Reference[T], predicate: (T) ⇒ Boolean): Double

    Return an estimate of the probability of the predicate under the marginal probability distribution of the target.

    Return an estimate of the probability of the predicate under the marginal probability distribution of the target.

    Definition Classes
    BaseProbQueryAlgorithm
  12. def computeProjection[T](target: Reference[T]): List[(T, Double)]
    Attributes
    protected[com.cra.figaro.algorithm]
    Definition Classes
    ParSamplerBaseProbQueryAlgorithm
  13. def distribution[T](target: Reference[T]): Stream[(Double, T)]

    Return an estimate of the marginal probability distribution over the target that lists each element with its probability.

    Return an estimate of the marginal probability distribution over the target that lists each element with its probability. The result is a lazy stream. It is up to the algorithm how the stream is ordered. Throws NotATargetException if called on a target that is not in the list of targets of the algorithm. Throws AlgorithmInactiveException if the algorithm is inactive.

    Definition Classes
    BaseProbQueryAlgorithm
  14. def doDistribution[T](target: Reference[T]): Stream[(Double, T)]

    Methods from BaseProbQueryAlgorithm *

    Methods from BaseProbQueryAlgorithm *

    Attributes
    protected
    Definition Classes
    ParSamplerBaseProbQueryAlgorithm
  15. def doExpectation[T](target: Reference[T], function: (T) ⇒ Double): Double
    Attributes
    protected
    Definition Classes
    ParSamplerBaseProbQueryAlgorithm
  16. def doKill(): Unit
    Attributes
    protected[com.cra.figaro.algorithm]
    Definition Classes
    ParSamplingAlgorithmAlgorithm
  17. def doProbability[T](target: Reference[T], predicate: (T) ⇒ Boolean): Double
    Attributes
    protected
    Definition Classes
    ParSamplerBaseProbQueryAlgorithm
  18. def doProjection[T](target: Reference[T]): List[(T, Double)]
    Attributes
    protected
    Definition Classes
    ParSamplerBaseProbQueryAlgorithm
  19. def doResume(): Unit
    Attributes
    protected[com.cra.figaro.algorithm]
    Definition Classes
    ParSamplingAlgorithmAlgorithm
  20. def doStart(): Unit
    Attributes
    protected[com.cra.figaro.algorithm]
    Definition Classes
    ParSamplingAlgorithmAlgorithm
  21. def doStop(): Unit
    Attributes
    protected[com.cra.figaro.algorithm]
    Definition Classes
    ParSamplingAlgorithmAlgorithm
  22. def element[T](alg: ProbQuerySampler, element: Reference[T]): Element[T]

    Get an element from a reference *

    Get an element from a reference *

    Attributes
    protected
  23. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  25. def expectation[T](target: Reference[T])(function: (T) ⇒ Double, c: Any = DummyImplicit): Double

    Return an estimate of the expectation of the function under the marginal probability distribution of the target.

    Return an estimate of the expectation of the function under the marginal probability distribution of the target. Throws NotATargetException if called on a target that is not in the list of targets of the algorithm. Throws AlgorithmInactiveException if the algorithm is inactive.

    Definition Classes
    BaseProbQueryAlgorithm
  26. def expectation[T](target: Reference[T], function: (T) ⇒ Double): Double

    Return an estimate of the expectation of the function under the marginal probability distribution of the target.

    Return an estimate of the expectation of the function under the marginal probability distribution of the target. Throws NotATargetException if called on a target that is not in the list of targets of the algorithm. Throws AlgorithmInactiveException if the algorithm is inactive.

    Definition Classes
    BaseProbQueryAlgorithm
  27. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  28. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  29. def getTotalWeight: Double

    Log sum of total weights of individual algorithms *

    Log sum of total weights of individual algorithms *

    Definition Classes
    ParSamplerBaseProbQuerySampler
  30. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  31. def initialize(): Unit

    Calls initialize() on all algorithms.

    Calls initialize() on all algorithms.

    Definition Classes
    ParSamplingAlgorithmAlgorithm
  32. def isActive: Boolean
    Definition Classes
    Algorithm
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. def kill(): Unit

    Kill the algorithm so that it is inactive.

    Kill the algorithm so that it is inactive. It will no longer be able to provide answers.Throws AlgorithmInactiveException if the algorithm is not active.

    Definition Classes
    Algorithm
  35. def mean(target: Reference[Double]): Double

    Return the mean of the probability density function for the given continuous element.

    Return the mean of the probability density function for the given continuous element.

    Definition Classes
    BaseProbQueryAlgorithm
  36. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  37. final def notify(): Unit
    Definition Classes
    AnyRef
  38. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  39. val parAlgs: ParSeq[ProbQuerySampler]

    A parallel collection of algorithms *

    A parallel collection of algorithms *

    Attributes
    protected
    Definition Classes
    ParSamplerParSamplingAlgorithm
  40. def probability[T](target: Reference[T], value: T): Double

    Return an estimate of the probability that the target produces the value.

    Return an estimate of the probability that the target produces the value. Throws NotATargetException if called on a target that is not in the list of targets of the algorithm. Throws AlgorithmInactiveException if the algorithm is inactive.

    Definition Classes
    BaseProbQueryAlgorithm
  41. def probability[T](target: Reference[T])(predicate: (T) ⇒ Boolean, c: Any = DummyImplicit): Double

    Return an estimate of the probability of the predicate under the marginal probability distribution of the target.

    Return an estimate of the probability of the predicate under the marginal probability distribution of the target. Throws NotATargetException if called on a target that is not in the list of targets of the algorithm. Throws AlgorithmInactiveException if the algorithm is inactive.

    Definition Classes
    BaseProbQueryAlgorithm
  42. def probability[T](target: Reference[T], predicate: (T) ⇒ Boolean): Double

    Return an estimate of the probability of the predicate under the marginal probability distribution of the target.

    Return an estimate of the probability of the predicate under the marginal probability distribution of the target. Throws NotATargetException if called on a target that is not in the list of targets of the algorithm. Throws AlgorithmInactiveException if the algorithm is inactive.

    Definition Classes
    BaseProbQueryAlgorithm
  43. val queryTargets: Seq[Reference[_]]

    The query targets are references in this case *

    The query targets are references in this case *

    Definition Classes
    ParSamplerBaseProbQueryAlgorithm
  44. def resume(): Unit

    Resume the computation of the algorithm, if it has been stopped.

    Resume the computation of the algorithm, if it has been stopped. Throws AlgorithmInactiveException if the algorithm is not active.

    Definition Classes
    Algorithm
  45. def start(): Unit

    Start the algorithm and make it active.

    Start the algorithm and make it active. After it returns, the algorithm must be ready to provide answers. Throws AlgorithmActiveException if the algorithm is already active.

    Definition Classes
    Algorithm
  46. def stop(): Unit

    Stop the algorithm from computing.

    Stop the algorithm from computing. The algorithm is still ready to provide answers after it returns. Throws AlgorithmInactiveException if the algorithm is not active.

    Definition Classes
    Algorithm
  47. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  48. def toString(): String
    Definition Classes
    AnyRef → Any
  49. def variance(target: Reference[Double]): Double

    Return the variance of the probability density function for the given continuous element.

    Return the variance of the probability density function for the given continuous element.

    Definition Classes
    BaseProbQueryAlgorithm
  50. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  52. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ParSamplingAlgorithm

Inherited from Algorithm

Inherited from AnyRef

Inherited from Any

Ungrouped