Package com.bayesserver
Interface Distribution
-
- All Known Implementing Classes:
CLGaussian
,Table
public interface Distribution
Interface specifying the required methods and properties for a probability distribution. For example theTable
class implements this interface. While a distribution is assigned to aNode
it cannot be modified.- See Also:
Table
,CLGaussian
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Distribution
copy()
Creates a copy of the distribution.Distribution
copy(Integer timeShift)
Creates a copy of the distribution, and shifts any times associated with variables by the specified amount.Distribution
divide(Distribution subset)
Creates a new distribution by dividing the instance by the specified subset.boolean
getLocked()
Locks or unlocks a distribution.Distribution
getOuter()
Returns the parent distribution, if this instance is aggregated by another distribution.Node
getOwner()
Gets the current owner, if assigned to a node.VariableContextCollection
getSortedVariables()
Gets the collection of variables in the distribution, sorted by time (which may be null) and the order in which variables were created.Table
getTable()
Gets theTable
which specifies the distribution over any discrete variables.Distribution
instantiate(Double[] values)
Calculates the distribution which results from instantiating a number of variables.boolean
isReadOnly()
Indicates whether the distribution is read only.void
marginalize(Distribution superset)
Marginalizes (sums/integrates) the [superset] into this instance.void
marginalize(Distribution superset, PropagationMethod propagation)
Marginalizes (sums/integrates) the [superset] into this instance.Distribution
multiply(Distribution distribution)
Creates a new distribution which is the result of multiplying this instance by another distribution.void
setLocked(boolean value)
Locks or unlocks a distribution.void
timeShift(int units)
Shifts any times associated with the distribution variables by the specified number of time units.
-
-
-
Method Detail
-
getSortedVariables
VariableContextCollection getSortedVariables()
Gets the collection of variables in the distribution, sorted by time (which may be null) and the order in which variables were created.- Returns:
- Variables sorted by time and the order in which variables were created.
-
timeShift
void timeShift(int units)
Shifts any times associated with the distribution variables by the specified number of time units.- Parameters:
units
- The number of time units to shift. Can be negative if required.
-
getLocked
boolean getLocked()
Locks or unlocks a distribution. The distribution cannot be modified if eithergetLocked()
istrue
orgetOwner()
is not null.- Returns:
true
if locked; otherwise,false
.
-
setLocked
void setLocked(boolean value)
Locks or unlocks a distribution. The distribution cannot be modified if eithergetLocked()
istrue
orgetOwner()
is not null.- Parameters:
value
-true
if locked; otherwise,false
.
-
isReadOnly
boolean isReadOnly()
Indicates whether the distribution is read only. A distribution is read only if it is locked or is assigned to aNode
.- Returns:
true
if read only; otherwise,false
.
-
getOwner
Node getOwner()
Gets the current owner, if assigned to a node. A distribution cannot be modified when it is assigned to a node.
-
getOuter
Distribution getOuter()
Returns the parent distribution, if this instance is aggregated by another distribution.
-
multiply
Distribution multiply(Distribution distribution)
Creates a new distribution which is the result of multiplying this instance by another distribution.- Parameters:
distribution
- The distribution to multiply this instance by.- Returns:
- The combined distribution.
-
divide
Distribution divide(Distribution subset)
Creates a new distribution by dividing the instance by the specified subset. Also known as the complement. The returned distribution, if multiplied by the subset, would be equivalent to this instance.- Parameters:
subset
- The subset to divide by.- Returns:
- A new distribution.
-
instantiate
Distribution instantiate(Double[] values)
Calculates the distribution which results from instantiating a number of variables. [values] should contain one entry for each- Parameters:
values
- The instantiated values. Entries can be null.- Returns:
- The instantiated distribution.
- See Also:
in the distribution, however entries can be null.
-
marginalize
void marginalize(Distribution superset)
Marginalizes (sums/integrates) the [superset] into this instance.- Parameters:
superset
- A distribution whose variables form a superset of the variables in this instance.
-
marginalize
void marginalize(Distribution superset, PropagationMethod propagation)
Marginalizes (sums/integrates) the [superset] into this instance.- Parameters:
superset
- A distribution whose variables form a superset of the variables in this instance.propagation
- The propagation method to use during marginalization.
-
copy
Distribution copy()
Creates a copy of the distribution. The new distribution will not have an owner.- Returns:
- A copy of the distribution.
-
copy
Distribution copy(Integer timeShift)
Creates a copy of the distribution, and shifts any times associated with variables by the specified amount. The new distribution will not have an owner.- Parameters:
timeShift
- The amount to shift any times present in the distribution. Can be negative.- Returns:
- A copy of this instance, with shifted times.
-
-