Package

com.cra.figaro

language

Permalink

package language

Visibility
  1. Public
  2. All

Type Members

  1. class Aggregate[T, U] extends ReferenceElement[T, U] with ValuesMaker[U]

    Permalink

    Aggregate elements based on multi-valued references.

    Aggregate elements based on multi-valued references. Note that the values aggregated over are all the values of all elements that are referred to by the reference. If the same element is reachable by more than one path in the reference, its value is only included once. However, if two different referred to elements have the same value, the value is included multiple times. Since the order of these values is immaterial, we use a multiset to represent them.

  2. abstract class Apply[U] extends Deterministic[U] with IfArgsCacheable[U]

    Permalink

    Abstract base class for elements representing function application.

    Abstract base class for elements representing function application. The function is cached to force different applications of the function to the same argument to result in equal values.

  3. class Apply1[T1, U] extends Apply[U]

    Permalink

    Application of a function to one argument.

  4. class Apply2[T1, T2, U] extends Apply[U]

    Permalink

    Application of a function to two arguments.

  5. class Apply3[T1, T2, T3, U] extends Apply[U]

    Permalink

    Application of a function to three arguments.

  6. class Apply4[T1, T2, T3, T4, U] extends Apply[U]

    Permalink

    Application of a function to four arguments.

  7. class Apply5[T1, T2, T3, T4, T5, U] extends Apply[U]

    Permalink

    Application of a function to five arguments.

  8. trait ArrayParameter extends Element[Array[Double]] with Parameter[Array[Double]]

    Permalink
  9. trait Atomic[T] extends Element[T] with HasDensity[T]

    Permalink

    The Atomic trait characterizes elements that do not depend on any related elements.

  10. class AtomicDist[T] extends Dist[Double, T]

    Permalink

    A distribution in which the probabilities are constants and the outcomes are Elements.

  11. class AtomicFlip extends Element[Boolean] with Atomic[Boolean] with Flip

    Permalink

    A coin toss in which the weight is a fixed constant.

  12. class AtomicSelect[T] extends Select[Double, T] with Atomic[T]

    Permalink

    A distribution in which both the probabilities and the outcomes are values.

    A distribution in which both the probabilities and the outcomes are values. Each outcome is chosen with the corresponding probability.

  13. trait Cacheable[V] extends Element[V]

    Permalink

    Elements whose values can be cached and reused.

  14. class CachingChain[T, U] extends Chain[T, U]

    Permalink

    A CachingChain is an implementation of Chain with a 1000 element cache.

  15. class Chain[T, U] extends Deterministic[U]

    Permalink

    A Chain(parent, fcn) represents the process that first generates a value for the parent, then applies fcn to get a new Element, and finally generates a value from that new Element.

    A Chain(parent, fcn) represents the process that first generates a value for the parent, then applies fcn to get a new Element, and finally generates a value from that new Element.

    Chain is the common base class for caching and non-caching chains. There is no functional difference between caching and non-caching chains. Algorithms can use the distinction to implement a caching procedure.

  16. class CompoundDist[T] extends Dist[Element[Double], T]

    Permalink

    A distribution in which both the probabilities and outcomes are Elements.

  17. class CompoundFlip extends Element[Boolean] with Flip

    Permalink

    A coin toss where the weight is itself an element.

  18. class CompoundSelect[T] extends Select[Element[Double], T]

    Permalink

    A distribution in which the probabilities are Elements and the outcomes are values.

  19. case class Condition[T](predicate: (T) ⇒ Boolean) extends Evidence[T] with Product with Serializable

    Permalink

    Evidence representing a condition on an element.

    Evidence representing a condition on an element.

    predicate

    The predicate that must be satisfied by the element.

  20. class Constant[T] extends Deterministic[T] with Cacheable[T]

    Permalink

    Elements that always produce the same value.

  21. case class Constraint[T](function: (T) ⇒ Double) extends Evidence[T] with Product with Serializable

    Permalink

    Evidence representing a constraint on an element.

    Evidence representing a constraint on an element.

    function

    The constraint to be applied to the element.

  22. trait Continuous[T] extends Element[T]

    Permalink

    Trait of elements representing continuous probability distributions

  23. trait Creatable extends AnyRef

    Permalink

    Figaro's reflection allows you to create a Figaro element by providing the name of the element class as a string and its arguments as elements.

    Figaro's reflection allows you to create a Figaro element by providing the name of the element class as a string and its arguments as elements. This can be useful, e.g., for compilers. In order to be able to create an instance of a particular element class, the class must implement the Creatable trait.

  24. abstract class Deterministic[Value] extends Element[Value]

    Permalink

    Elements with no randomness.

  25. abstract class Dist[P, T] extends Element[T] with IfArgsCacheable[T]

    Permalink

    Distributions with randomly chosen outcomes that are themselves specified by Elements.

    Distributions with randomly chosen outcomes that are themselves specified by Elements. The probabilities can either be simple (Doubles) or complex (Elements).

    P

    The type of the probability specification.

    T

    The type of values of this element.

  26. trait DoubleParameter extends Element[Double] with Parameter[Double]

    Permalink
  27. abstract class Element[T] extends AnyRef

    Permalink

    An Element is the core component of a probabilistic model.

    An Element is the core component of a probabilistic model. Elements can be understood as defining a probabilistic process. Elements are parameterized by the type of Value the process produces.

    Each Element is a mix of a random component and a deterministic component. The random component has type Randomness. The generateRandomness method generates the Randomness according to a probability distribution. The generateValue method is a deterministic function that generates the output Value of the Element from the Randomness. Thus, Elements can be understood as defining a generative process in which first the Randomness is generated and then the output Value is generated given the Randomness.

    Elements also have a current outcome, represented by the value field. Naturally, the generateValue function can refer to the current value of related Elements. However, generateValue is not allowed to call generateValue on another Element. We use the notation generateValue(r | w) to denote the value it produces given randomness r when the current value of related Elements is w.

    Elements can have hard conditions and soft constraints. A condition is a predicate on Values that must be satisfied by the output of the Element. Values that violate the condition have probability zero. A constraint is a function that maps Values to Doubles. The probability of a Value is multiplied by the constraint, and then normalized. Conditions and constraints can be contingent on other elements taking on particular values. Ordinarily, these contingencies will not be specified by the user, but automatically by other Figaro code. In particular, specifying named evidence on a reference can result in contingencies.

    Thus, an Element represents a conditional probability distribution over Values given the current values w of related Elements. The probability of an outcome v is defined by:

    P(v | w) is proportional to (\sum_{r: generateValue(r | w) = v} P(generateRandomness() = r) * constraint(v)) if condition(v); 0 otherwise

    An element has a name and belongs to an element collection that is used to find the element the name.

    Elements can be cacheable or non-cacheable, which determines what type of Chain will be created for them. If you create a new Element class that you want to be cached, you should declare it to implement the Cacheable or IfArgsCacheable traits.

  28. trait ElementCollection extends AnyRef

    Permalink

    An element collection contains elements.

    An element collection contains elements. It can be used to find the elements in it by reference.

  29. sealed abstract class Evidence[T] extends AnyRef

    Permalink

    Evidence that can be associated with an element.

  30. trait Flip extends Element[Boolean] with Cacheable[Boolean]

    Permalink

    Weighted coin tosses, where the weight itself might be random.

  31. trait HasDensity[T] extends Element[T]

    Permalink

    Trait of elements for which a density method is defined.

  32. trait IfArgsCacheable[V] extends Element[V]

    Permalink

    Elements whose values can be cached and reused as long as the arguments are cacheable.

  33. case class Indirect[+T](head: Name[ElementCollection], tail: Reference[T]) extends Reference[T] with Product with Serializable

    Permalink

    An indirect reference to an element, first using the head to refer to an element collection, and then referring to the tail from within the element collection.

    An indirect reference to an element, first using the head to refer to an element collection, and then referring to the tail from within the element collection.

    head

    The name of the element whose value is the element collection that resolves the tail.

    tail

    The remaining reference to be resolved.

  34. class Inject[T] extends Deterministic[List[T]] with IfArgsCacheable[List[T]]

    Permalink

    Element that converts a sequence of elements into an element over sequences.

  35. class InvalidEvidenceException extends IllegalArgumentException

    Permalink
  36. case class LogConstraint[T](function: (T) ⇒ Double) extends Evidence[T] with Product with Serializable

    Permalink

    Evidence representing a log constraint on an element.

    Evidence representing a log constraint on an element.

    function

    The constraint (in log form) to be applied to the element.

  37. class MultiValuedReferenceElement[T] extends ReferenceElement[T, MultiSet[T]] with ValuesMaker[MultiSet[T]]

    Permalink

    Element representing the values of a reference that can have multiple values.

  38. case class Name[+T](string: String) extends Reference[T] with Product with Serializable

    Permalink

    A direct reference to an element by its name.

    A direct reference to an element by its name.

    string

    A string representation of the name

  39. case class NamedEvidence[T](reference: Reference[T], evidence: Evidence[T], contingency: Contingency = List()) extends Product with Serializable

    Permalink

    Association of evidence with a reference.

    Association of evidence with a reference.

    reference

    The reference to apply the evidence.

    contingency

    Optional contingency that must be satisfied for this evidence to be applied.

  40. class NonCachingChain[T, U] extends Chain[T, U]

    Permalink

    A NonCachingChain is an implementation of Chain with a single element cache.

  41. case class Observation[T](value: T) extends Evidence[T] with Product with Serializable

    Permalink

    Evidence representing observing a particular value for the element.

    Evidence representing observing a particular value for the element. Note that using an Observation on a reference is not the same as calling observe on the element directly. This version applies a condition to the element, thus bypassing some specialized operations that can be accomplished by calling the observe on the element directly (such as Likelihood weighting).

    value

    The observed value of the element.

  42. trait Parameter[T] extends Element[T] with Atomic[T]

    Permalink

    Trait of learnable parameters.

    Trait of learnable parameters. Parameters are elements which can learn their value from data.

  43. trait Parameterized[T] extends Element[T] with HasDensity[T]

    Permalink

    Trait of elements which accept learnable parameters.

    Trait of elements which accept learnable parameters. Parameterized elements are compound elements whose outcome is determined by a learnable parameter.

  44. class ParameterizedFlip extends Element[Boolean] with Flip with SingleParameterized[Boolean]

    Permalink

    A coin toss where the weight is specified by a learnable parameter.

  45. class ParameterizedSelect[T] extends Select[Double, T] with SingleParameterized[T]

    Permalink

    A distribution in which the probabilities are learnable parameters and the outcomes are values.

  46. trait Pragma[T] extends AnyRef

    Permalink

    Pragmas are hints to algorithms that are associated with elements.

    Pragmas are hints to algorithms that are associated with elements. A Pragma is parameterized by the type parameter of the element to which it is attached. Pragmas are added to elements using Element's addPragma method. More recently added pragmas can shadow older pragmas of the same type. Pragmas can be removed using Element's removePragma method.

  47. sealed trait Reference[+T] extends AnyRef

    Permalink

    A reference to an element.

  48. abstract class ReferenceElement[T, U] extends Deterministic[U] with IfArgsCacheable[U]

    Permalink

    Element representing the value of a reference.

  49. abstract class Select[P, T] extends Element[T] with Cacheable[T]

    Permalink

    Distributions with randomly chosen outcomes.

    Distributions with randomly chosen outcomes. The probabilities can either be simple (Doubles) or complex (Elements).

    P

    The type of the probability specification.

    T

    The type of values of this element.

  50. trait SingleParameterized[T] extends Element[T] with Parameterized[T]

    Permalink
  51. class SingleValuedReferenceElement[T] extends ReferenceElement[T, T] with ValuesMaker[T]

    Permalink

    Element representing a single-valued reference.

    Element representing a single-valued reference. Its value in a state is generated by following the reference in the state and taking the value of the resulting element.

  52. class Universe extends ElementCollection

    Permalink

    A universe is a collection of elements that can be used by a reasoning algorithm.

    A universe is a collection of elements that can be used by a reasoning algorithm.

    Ordinarily, the arguments of elements in a universe must also belong to the universe. You can optionally supply a list of parent elements that contains other elements that can be arguments.

Value Members

  1. object Apply

    Permalink
  2. object AssertEvidence

    Permalink
  3. object CachingChain

    Permalink
  4. object Chain

    Permalink
  5. object Constant

    Permalink
  6. object Create

    Permalink
  7. object Dist

    Permalink
  8. object Element

    Permalink
  9. object ElementCollection

    Permalink
  10. object Flip extends Creatable

    Permalink
  11. object Inject

    Permalink
  12. object Name extends Serializable

    Permalink
  13. object NonCachingChain

    Permalink
  14. object Reference

    Permalink
  15. object Select

    Permalink
  16. object Universe

    Permalink

Ungrouped