Trait

com.cra.figaro.experimental.normalproposals

NormalProposer

Related Doc: package normalproposals

Permalink

trait NormalProposer extends Element[Double] with Atomic[Double]

Normally distributed proposals for univariate continuous elements. This works by proposing from a truncated normal distribution over the randomness of this element. This implementation assumes that the probability density of values associated with randomnesses in the range (lower, upper) are finite.

Linear Supertypes
Atomic[Double], HasDensity[Double], Element[Double], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. NormalProposer
  2. Atomic
  3. HasDensity
  4. Element
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. type Condition = (Double) ⇒ Boolean

    Permalink

    The type of conditions on the element.

    The type of conditions on the element. A condition is a function from a value to a Boolean.

    Definition Classes
    Element
  2. type Constraint = (Double) ⇒ Double

    Permalink

    The type of soft constraints on the element.

    The type of soft constraints on the element. A constraint is a function from a value to a Double.

    Definition Classes
    Element
  3. type Randomness = Double

    Permalink

    The type of randomness content of the element.

    The type of randomness content of the element.

    Definition Classes
    NormalProposerElement
  4. type Value = Double

    Permalink

    The type of values over which the element is defined.

    The type of values over which the element is defined.

    Definition Classes
    Element

Abstract Value Members

  1. abstract def density(t: Double): Double

    Permalink

    The probability density of a value.

    The probability density of a value.

    Definition Classes
    HasDensity
  2. abstract def generateRandomness(): Randomness

    Permalink

    Generate the randomness content.

    Generate the randomness content.

    Definition Classes
    Element
  3. abstract def proposalScale: Double

    Permalink

    The scale of the normally distributed proposal.

    The scale of the normally distributed proposal. This corresponds to the standard deviation of the proposal before truncation. If the randomness has finite variance, this should be less than or equal to its standard deviation. A good place to start is e.g. 20% of the standard deviation.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. def !==(that: Element[Value])(implicit universe: Universe): Neq[Value]

    Permalink

    The element that tests inequality of this element with another element.

    The element that tests inequality of this element with another element.

    Definition Classes
    Element
  3. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  5. def ===(that: Value)(implicit universe: Universe): Apply1[Double, Boolean]

    Permalink

    The element that tests whether the value of this element is equal to a particular value.

    The element that tests whether the value of this element is equal to a particular value.

    Definition Classes
    Element
  6. def ===(that: Element[Value])(implicit universe: Universe): Eq[Value]

    Permalink

    The element that tests equality of this element with another element.

    The element that tests equality of this element with another element.

    Definition Classes
    Element
  7. def activate(): Unit

    Permalink

    Activate the element in its universe.

    Activate the element in its universe.

    Definition Classes
    Element
  8. var active: Boolean

    Permalink

    Flag indicating whether the element is currently active in its universe.

    Flag indicating whether the element is currently active in its universe.

    Definition Classes
    Element
  9. def addCondition(condition: Condition, contingency: Contingency = List()): Unit

    Permalink

    Add the given condition to the existing conditions of the element.

    Add the given condition to the existing conditions of the element. By default, the contingency is empty.

    Definition Classes
    Element
  10. def addConstraint(constraint: Constraint, contingency: Contingency = List()): Unit

    Permalink

    Add a contingent constraint to the element.

    Add a contingent constraint to the element. By default, the contingency is empty.

    Definition Classes
    Element
  11. def addLogConstraint(constraint: Constraint, contingency: Contingency = List()): Unit

    Permalink

    Add a log contingent constraint to the element.

    Add a log contingent constraint to the element. By default, the contingency is empty.

    Definition Classes
    Element
  12. def addPragma(pragma: Pragma[Value]): Unit

    Permalink

    Add a pragma to the element.

    Add a pragma to the element.

    Definition Classes
    Element
  13. def allConditions: List[(Condition, Contingency)]

    Permalink

    All the conditions defined on this element.

    All the conditions defined on this element.

    Definition Classes
    Element
  14. def allConstraints: List[(Constraint, Contingency)]

    Permalink

    The current soft constraints on the element.

    The current soft constraints on the element.

    Definition Classes
    Element
  15. def args: List[Element[_]]

    Permalink

    Returns an empty list.

    Returns an empty list.

    Definition Classes
    AtomicElement
  16. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  17. def clearContext(): Unit

    Permalink

    Clears all the temporary elements associated with this element (all elements created in it's context).

    Clears all the temporary elements associated with this element (all elements created in it's context).

    Definition Classes
    Element
  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. val collection: ElementCollection

    Permalink

    The element collection to which this element belongs

    The element collection to which this element belongs

    Definition Classes
    Element
  20. def condition(value: Any): Boolean

    Permalink

    Tests whether all the element's contingent conditions are satisfied for the given value.

    Tests whether all the element's contingent conditions are satisfied for the given value.

    Definition Classes
    Element
  21. def conditionSatisfied: Boolean

    Permalink

    Determines whether the condition on the element is satisfied by the current value.

    Determines whether the condition on the element is satisfied by the current value.

    Definition Classes
    Element
  22. def constraint(value: Any): Double

    Permalink

    Gets the result of all the element's contingent constraints for the given value.

    Gets the result of all the element's contingent constraints for the given value.

    Definition Classes
    Element
  23. def constraintValue: Double

    Permalink

    Determines the value of the constraint on the element applied to the current value.

    Determines the value of the constraint on the element applied to the current value.

    Definition Classes
    Element
  24. def context: List[Element[_]]

    Permalink

    The elements on which the existence of this element depends.

    The elements on which the existence of this element depends.

    Definition Classes
    Element
  25. def deactivate(): Unit

    Permalink

    Deactivate the element in its universe.

    Deactivate the element in its universe.

    Definition Classes
    Element
  26. def directContextContents: Set[Element[_]]

    Permalink

    Returns the set of elements directly created in the context of this element.

    Returns the set of elements directly created in the context of this element.

    Definition Classes
    Element
  27. def elementsIAmContingentOn: Set[Element[_]]

    Permalink

    Returns the elements that this element is contingent on.

    Returns the elements that this element is contingent on. These are elements that are required to have a certain value for a condition or constraint to be relevant to this element. The contingency is required because conditions and constraints can be applied to references that are uncertain. Every possible element that could be pointed to by a reference must be given the condition or constraint, but the condition or constraint only applies if the elements earlier in the reference have the required value.

    Figaro takes care of handling all this under the hood. However, some algorithms may need to know which elements an element is contingent on. For example, sampling algorithms may need to sample those other elements first. This method is supplied to support this use case.

    Definition Classes
    Element
  28. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  30. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. def flatMap[U](fn: (Value) ⇒ Element[U])(implicit name: Name[U], collection: ElementCollection): Element[U]

    Permalink
    Definition Classes
    Element
  32. final def generate(): Unit

    Permalink

    First generate the randomness, then generate the value given the randomness.

    First generate the randomness, then generate the value given the randomness. Store the results in randomness and value.

    Definition Classes
    Element
  33. def generateValue(rand: Randomness): Randomness

    Permalink

    A strictly monotone differentiable function defined on (lower, upper).

    A strictly monotone differentiable function defined on (lower, upper). Defaults to the identity function.

    Definition Classes
    NormalProposerElement
  34. def generateValueDerivative(rand: Randomness): Double

    Permalink

    The absolute value of the derivative of generateValue with respect to the randomness given.

    The absolute value of the derivative of generateValue with respect to the randomness given. This is needed to compute a proposal density over the transformed randomness. Defaults to 1.0, corresponding to the case where generateValue is the identity function.

  35. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  36. val hashCode: Int

    Permalink
    Definition Classes
    Element → AnyRef → Any
  37. def isCachable(): Boolean

    Permalink

    The cacheability of the element.

    The cacheability of the element. Chains create caches of their parent values, and it is useful to know when these values can be effectively cached and reused. In general, continuous distributions are not cacheable.

    Definition Classes
    Element
  38. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  39. def isTemporary: Boolean

    Permalink

    Returns true if this element is temporary, that is, was created in the context of another element.

    Returns true if this element is temporary, that is, was created in the context of another element.

    Definition Classes
    Element
  40. def lower: Double

    Permalink

    Exclusive lower bound of the range of the randomness of this element.

    Exclusive lower bound of the range of the randomness of this element. Defaults to -Infinity. Must be strictly less than the upper bound.

  41. def map[U](fn: (Value) ⇒ U)(implicit name: Name[U], collection: ElementCollection): Element[U]

    Permalink
    Definition Classes
    Element
  42. val name: Name[Double]

    Permalink

    The name of the element

    The name of the element

    Definition Classes
    Element
  43. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  44. def nextRandomness(oldRandomness: Randomness): (Randomness, Double, Double)

    Permalink

    Generate the next randomness given the current randomness.

    Generate the next randomness given the current randomness. Returns three values: The next randomness, the Metropolis-Hastings proposal probability ratio, which is:

    P(new -> old) / P(old -> new)

    and the model probability ratio, which is:

    P(new) / P(old)

    By default, this implementation proposes a normally distributed randomness from the previous randomness, truncated to be within the appropriate range. The probability ratios returned are associated with the values of this element rather than the randomness. This is for the purpose of simulated annealing, since the most likely randomness is not necessarily the most likely value, depending on the form of the generateValue function.

    One can override this to only use normal proposals in certain special cases.

    Definition Classes
    NormalProposerHasDensityElement
  45. final def normalNextRandomness(oldRandomness: Randomness): (Randomness, Double, Double)

    Permalink

    Computes the normal proposal for nextRandomness.

    Computes the normal proposal for nextRandomness. This is separated from the nextRandomness so that subclasses can choose when to use normal proposals.

    Attributes
    protected
    Annotations
    @tailrec()
  46. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  48. def observe(observation: Value): Unit

    Permalink

    Condition the element by observing a particular value.

    Condition the element by observing a particular value. Propagates the effect to dependent elements and ensures that no other value for the element can be generated.

    Definition Classes
    Element
  49. def pragmas: List[Pragma[Value]]

    Permalink

    The pragmas attached to the element.

    The pragmas attached to the element.

    Definition Classes
    Element
  50. def proposalProb(oldRandomness: Double, newRandomness: Double): Double

    Permalink

    Computes the proposal probability density in one direction.

    Computes the proposal probability density in one direction. Both values should be in the interval (lower, upper).

    oldRandomness

    The previous randomness.

    newRandomness

    The newly proposed randomness.

    returns

    The probability density associated with the transition from generateValue(oldRandomness) to generateValue(newRandomness). This is a density over the corresponding values (as opposed to randomnesses).

    Attributes
    protected
  51. var randomness: Randomness

    Permalink

    The current randomness content of the element.

    The current randomness content of the element.

    Definition Classes
    Element
  52. def removeConditions(contingency: Contingency = List()): Unit

    Permalink

    Remove all conditions associated with the given contingency.

    Remove all conditions associated with the given contingency. By default, the contingency is empty.

    Definition Classes
    Element
  53. def removeConstraint(constraint: Constraint, contingency: Contingency = List()): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Element
  54. def removeConstraints(contingency: Contingency = List()): Unit

    Permalink

    Remove all constraints associated with the given contingency.

    Remove all constraints associated with the given contingency. By default, the contingency is empty.

    Definition Classes
    Element
  55. def removePragma(pragma: Pragma[Value]): Unit

    Permalink

    Remove a pragma from the element.

    Remove a pragma from the element.

    Definition Classes
    Element
  56. def score(oldValue: Value, newValue: Value): Double

    Permalink

    Compute the constraints on the new value divided by the constraints on the old value.

    Compute the constraints on the new value divided by the constraints on the old value.

    Definition Classes
    Element
  57. def set(newValue: Value): Unit

    Permalink

    Set the value of this element and propagate the effects to elements that depend on it without changing their randomness.

    Set the value of this element and propagate the effects to elements that depend on it without changing their randomness. Also disallows the value of the element to change until unobserve or unset is called.

    Definition Classes
    Element
  58. def setCondition(newCondition: Condition, contingency: Contingency = List()): Unit

    Permalink

    Set the condition associated with the contingency.

    Set the condition associated with the contingency. Removes previous conditions associated with the contingency. By default, the contingency is empty.

    Definition Classes
    Element
  59. def setConstraint(newConstraint: Constraint, contingency: Contingency = List()): Unit

    Permalink

    Set the constraint associated with the contingency.

    Set the constraint associated with the contingency. Removes previous constraints associated with the contingency. By default, the contingency is empty.

    Definition Classes
    Element
  60. def setLogConstraint(newConstraint: Constraint, contingency: Contingency = List()): Unit

    Permalink

    Set the log constraint associated with the contingency.

    Set the log constraint associated with the contingency. Removes previous constraints associated with the contingency. By default, the contingency is empty.

    Definition Classes
    Element
  61. def setRandomness(newRandomness: Randomness): Unit

    Permalink

    Set the randomness of this element.

    Set the randomness of this element.

    Will generate its value using the new randomness and propagate the effects to elements that depend on it without changing their randomness.

    Definition Classes
    Element
  62. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  63. def toNameString: String

    Permalink

    A string that is the element's name, if it has a non-empty one, otherwise the result of the element's toString.

    A string that is the element's name, if it has a non-empty one, otherwise the result of the element's toString.

    Definition Classes
    Element
  64. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  65. val universe: Universe

    Permalink

    The universe in which the element is defined.

    The universe in which the element is defined.

    Definition Classes
    Element
  66. def unobserve(): Unit

    Permalink

    Removes conditions on the element and allows different values of the element to be generated.

    Removes conditions on the element and allows different values of the element to be generated.

    Definition Classes
    Element
  67. def unset(): Unit

    Permalink

    Allows different values of the element to be generated.

    Allows different values of the element to be generated.

    Definition Classes
    Element
  68. def upper: Double

    Permalink

    Exclusive upper bound of the range of the randomness of this element.

    Exclusive upper bound of the range of the randomness of this element. Defaults to Infinity. Must be strictly greater than the lower bound.

  69. var value: Value

    Permalink

    The current value of the element.

    The current value of the element.

    Definition Classes
    Element
  70. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Atomic[Double]

Inherited from HasDensity[Double]

Inherited from Element[Double]

Inherited from AnyRef

Inherited from Any

Ungrouped