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.
Onetime 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.
 Alphabetic
 By Inheritance
 ParSampler
 ParSamplingAlgorithm
 BaseProbQuerySampler
 BaseProbQueryAlgorithm
 Algorithm
 AnyRef
 Any
 Hide All
 Show All
 Public
 All
Instance Constructors
 new ParSampler(algs: Seq[ProbQuerySampler], targets: Reference[_]*)
Type Members

class
NotATargetException
[T] extends AlgorithmException
 Definition Classes
 BaseProbQueryAlgorithm
Value Members

final
def
!=(arg0: Any): Boolean
 Definition Classes
 AnyRef → Any

final
def
##(): Int
 Definition Classes
 AnyRef → Any

final
def
==(arg0: Any): Boolean
 Definition Classes
 AnyRef → Any

val
active: Boolean
 Attributes
 protected
 Definition Classes
 Algorithm

final
def
asInstanceOf[T0]: T0
 Definition Classes
 Any

def
check[T](target: Reference[T]): Unit
 Attributes
 protected
 Definition Classes
 BaseProbQueryAlgorithm

def
cleanUp(): Unit
Calls cleanUp() on all algorithms.
Calls cleanUp() on all algorithms.
 Definition Classes
 ParSamplingAlgorithm → Algorithm

def
clone(): AnyRef
 Attributes
 protected[java.lang]
 Definition Classes
 AnyRef
 Annotations
 @throws( ... )

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
 BaseProbQuerySampler → BaseProbQueryAlgorithm

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
 BaseProbQuerySampler → BaseProbQueryAlgorithm

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

def
computeProjection[T](target: Reference[T]): List[(T, Double)]
 Attributes
 protected[com.cra.figaro.algorithm]
 Definition Classes
 ParSampler → BaseProbQueryAlgorithm

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

def
doDistribution[T](target: Reference[T]): Stream[(Double, T)]
Methods from BaseProbQueryAlgorithm *
Methods from BaseProbQueryAlgorithm *
 Attributes
 protected
 Definition Classes
 ParSampler → BaseProbQueryAlgorithm

def
doExpectation[T](target: Reference[T], function: (T) ⇒ Double): Double
 Attributes
 protected
 Definition Classes
 ParSampler → BaseProbQueryAlgorithm

def
doKill(): Unit
 Attributes
 protected[com.cra.figaro.algorithm]
 Definition Classes
 ParSamplingAlgorithm → Algorithm

def
doProbability[T](target: Reference[T], predicate: (T) ⇒ Boolean): Double
 Attributes
 protected
 Definition Classes
 ParSampler → BaseProbQueryAlgorithm

def
doProjection[T](target: Reference[T]): List[(T, Double)]
 Attributes
 protected
 Definition Classes
 ParSampler → BaseProbQueryAlgorithm

def
doResume(): Unit
 Attributes
 protected[com.cra.figaro.algorithm]
 Definition Classes
 ParSamplingAlgorithm → Algorithm

def
doStart(): Unit
 Attributes
 protected[com.cra.figaro.algorithm]
 Definition Classes
 ParSamplingAlgorithm → Algorithm

def
doStop(): Unit
 Attributes
 protected[com.cra.figaro.algorithm]
 Definition Classes
 ParSamplingAlgorithm → Algorithm

def
element[T](alg: ProbQuerySampler, element: Reference[T]): Element[T]
Get an element from a reference *
Get an element from a reference *
 Attributes
 protected

final
def
eq(arg0: AnyRef): Boolean
 Definition Classes
 AnyRef

def
equals(arg0: Any): Boolean
 Definition Classes
 AnyRef → Any

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

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

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

final
def
getClass(): Class[_]
 Definition Classes
 AnyRef → Any

def
getTotalWeight: Double
Log sum of total weights of individual algorithms *
Log sum of total weights of individual algorithms *
 Definition Classes
 ParSampler → BaseProbQuerySampler

def
hashCode(): Int
 Definition Classes
 AnyRef → Any

def
initialize(): Unit
Calls initialize() on all algorithms.
Calls initialize() on all algorithms.
 Definition Classes
 ParSamplingAlgorithm → Algorithm

def
isActive: Boolean
 Definition Classes
 Algorithm

final
def
isInstanceOf[T0]: Boolean
 Definition Classes
 Any

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

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

final
def
ne(arg0: AnyRef): Boolean
 Definition Classes
 AnyRef

final
def
notify(): Unit
 Definition Classes
 AnyRef

final
def
notifyAll(): Unit
 Definition Classes
 AnyRef

val
parAlgs: ParSeq[ProbQuerySampler]
A parallel collection of algorithms *
A parallel collection of algorithms *
 Attributes
 protected
 Definition Classes
 ParSampler → ParSamplingAlgorithm

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

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

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

val
queryTargets: Seq[Reference[_]]
The query targets are references in this case *
The query targets are references in this case *
 Definition Classes
 ParSampler → BaseProbQueryAlgorithm

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

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

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

final
def
synchronized[T0](arg0: ⇒ T0): T0
 Definition Classes
 AnyRef

def
toString(): String
 Definition Classes
 AnyRef → Any

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

final
def
wait(): Unit
 Definition Classes
 AnyRef
 Annotations
 @throws( ... )

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

final
def
wait(arg0: Long): Unit
 Definition Classes
 AnyRef
 Annotations
 @throws( ... )