Package com.bayesserver
Interface Distribution
-
- All Known Implementing Classes:
CLGaussian,Table
public interface DistributionInterface specifying the required methods and properties for a probability distribution. For example theTableclass implements this interface. While a distribution is assigned to aNodeit cannot be modified.- See Also:
Table,CLGaussian
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Distributioncopy()Creates a copy of the distribution.Distributioncopy(Integer timeShift)Creates a copy of the distribution, and shifts any times associated with variables by the specified amount.Distributiondivide(Distribution subset)Creates a new distribution by dividing the instance by the specified subset.booleangetLocked()Locks or unlocks a distribution.DistributiongetOuter()Returns the parent distribution, if this instance is aggregated by another distribution.NodegetOwner()Gets the current owner, if assigned to a node.VariableContextCollectiongetSortedVariables()Gets the collection of variables in the distribution, sorted by time (which may be null) and the order in which variables were created.TablegetTable()Gets theTablewhich specifies the distribution over any discrete variables.Distributioninstantiate(Double[] values)Calculates the distribution which results from instantiating a number of variables.booleanisReadOnly()Indicates whether the distribution is read only.voidmarginalize(Distribution superset)Marginalizes (sums/integrates) the [superset] into this instance.voidmarginalize(Distribution superset, PropagationMethod propagation)Marginalizes (sums/integrates) the [superset] into this instance.Distributionmultiply(Distribution distribution)Creates a new distribution which is the result of multiplying this instance by another distribution.voidsetLocked(boolean value)Locks or unlocks a distribution.voidtimeShift(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()istrueorgetOwner()is not null.- Returns:
trueif locked; otherwise,false.
-
setLocked
void setLocked(boolean value)
Locks or unlocks a distribution. The distribution cannot be modified if eithergetLocked()istrueorgetOwner()is not null.- Parameters:
value-trueif 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:
trueif 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.
-
-