com.cra.figaro.algorithm.OneTimeBoundsProbQuery.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of figaro_2.12 Show documentation
Show all versions of figaro_2.12 Show documentation
Figaro: a language for probablistic programming
The newest version!
/*
* OneTimeBoundsProbQuery.scala
* One-time algorithms that compute bounds on conditional probabilities of query elements.
*
* Created By: William Kretschmer ([email protected])
* Creation Date: Jun 23, 2017
*
* Copyright 2017 Avrom J. Pfeffer and Charles River Analytics, Inc.
* See http://www.cra.com or email [email protected] for information.
*
* See http://www.github.com/p2t2/figaro for a copy of the software license.
*/
package com.cra.figaro.algorithm
import com.cra.figaro.language._
/**
* One-time algorithms that compute bounds on conditional probabilities of query elements. A class that implements this
* trait must implement run, computeAllProbabilityBounds, and computeExpectationBounds methods.
*/
trait OneTimeBoundsProbQuery extends BoundsProbQueryAlgorithm with OneTimeProbQuery {
protected def doAllProbabilityBounds[T](target: Element[T]): Stream[(Double, Double, T)] = {
computeAllProbabilityBounds(target)
}
protected def doExpectationBounds[T](target: Element[T], function: T => Double, bounds: Option[(Double, Double)]): (Double, Double) = {
computeExpectationBounds(target, function, bounds)
}
protected def doProbabilityBounds[T](target: Element[T], predicate: T => Boolean): (Double, Double) = {
computeProbabilityBounds(target, predicate)
}
}