Aggregate elements based on multi-valued references.
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.
Application of a function to one argument.
Application of a function to two arguments.
Application of a function to three arguments.
Application of a function to four arguments.
Application of a function to five arguments.
The Atomic trait characterizes elements that do not depend on any related elements.
A distribution in which the probabilities are constants and the outcomes are Elements.
A coin toss in which the weight is a fixed constant.
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.
Elements whose values can be cached and reused.
A CachingChain is an implementation of Chain with a 1000 element cache.
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.
A distribution in which both the probabilities and outcomes are Elements.
A coin toss where the weight is itself an element.
A distribution in which the probabilities are Elements and the outcomes are values.
Evidence representing a condition on an element.
Evidence representing a condition on an element.
The predicate that must be satisfied by the element.
Elements that always produce the same value.
Evidence representing a constraint on an element.
Evidence representing a constraint on an element.
The constraint to be applied to the element.
Trait of elements representing continuous probability distributions
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.
Elements with no randomness.
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).
The type of the probability specification.
The type of values of this element.
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.
An element collection contains elements.
An element collection contains elements. It can be used to find the elements in it by reference.
Evidence that can be associated with an element.
Weighted coin tosses, where the weight itself might be random.
Trait of elements for which a density method is defined.
Elements whose values can be cached and reused as long as the arguments are cacheable.
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.
The name of the element whose value is the element collection that resolves the tail.
The remaining reference to be resolved.
Element that converts a sequence of elements into an element over sequences.
Evidence representing a log constraint on an element.
Evidence representing a log constraint on an element.
The constraint (in log form) to be applied to the element.
Element representing the values of a reference that can have multiple values.
A direct reference to an element by its name.
A direct reference to an element by its name.
A string representation of the name
Association of evidence with a reference.
Association of evidence with a reference.
The reference to apply the evidence.
Optional contingency that must be satisfied for this evidence to be applied.
A NonCachingChain is an implementation of Chain with a single element cache.
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).
The observed value of the element.
Trait of learnable parameters.
Trait of learnable parameters. Parameters are elements which can learn their value from data.
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.
A coin toss where the weight is specified by a learnable parameter.
A distribution in which the probabilities are learnable parameters and the outcomes are values.
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.
A reference to an element.
Element representing the value of a reference.
Distributions with randomly chosen outcomes.
Distributions with randomly chosen outcomes. The probabilities can either be simple (Doubles) or complex (Elements).
The type of the probability specification.
The type of values of this element.
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.
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.
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.