Table
public class Table
Hugin uses Tables for representing the conditional probability and
utility potentials of individual Nodes, the probability and utility
potentials on separators and Cliques of JunctionTrees, evidence
potentials, etc.
A potential is a function from the state space of a set of
variables into the set of real numbers. A Table is a representation
of a potential.
-
Computes the state configuration corresponding to a given table index. The state index corresponding to the k'th (discrete) node in the node list of this
Tableis stored in the k'th entry of the configuration array.See also
Table.getNodes()Declaration
Swift
public func getConfiguration(_ index: Int) throws -> [Int] -
Computes the table index corresponding to a given state configuration. The state configuration is specified in the
configurationarray: A state index for the k'th (discrete) node in the node list of thisTablemust be specified in the k'th entry of the array. The length of the array must be greater than or equal to the number of discrete nodes of thisTable(extra entries are ignored).See also
Table.getNodes()Declaration
Swift
public func getIndex(_ configuration: [Int]) throws -> Int -
Returns an array containing a copy of the discrete data of this
Table. The array is a row-major representation of the actual multi-dimensional data. Note that this is a copy of the real data stored in the table. To update the table, the modified data must be copied back using the setData method.Declaration
Swift
public func getData() throws -> [Double] -
Returns a region of the discrete data of this
Table. The region is specified by astartposition and the number of elements (count) to copy. The data is copied to thedataarray. Note that since this is a copy of the real data stored in the table, updates will only take place when the data is copied back using the setData method.The indexes
start, …,start+count-1must be valid indexes of this table. Also,countmust be less than or equal to the size of thedataarray.Declaration
Swift
public func getData(start: Int, count: Int) throws -> [Double]Parameters
dataarray to hold the extracted data
startindex of the first element to copy
countnumber of elements to copy
-
Returns the data item at position
indexof the discrete data of thisTable. The index is interpreted as the index of a one-dimensional row-major representation of the actual multi-dimensional data.Declaration
Swift
public func getDataItem(_ index: Int) throws -> DoubleParameters
indexthe index of the data item
Return Value
The data item at the specified index.
-
Returns a NodeList containing the Nodes associated with this
Table.Declaration
Swift
public func getNodes() throws -> [Node] -
Returns the size of this
Table.Declaration
Swift
public func getSize() throws -> Int -
Returns the CG size of this
Table. This is the number of CG data elements stored in the table.Declaration
Swift
public func getCGSize() throws -> Int -
Sets the discrete data of this
Table. The contents of thedataarray are copied to the table. The size of the array must equal the size of the table.Declaration
Swift
public func setData(_ data: [Double]) throwsParameters
dataarray holding the data to copy to the table
-
Sets a region of the discrete data of this
Table. The region is specified by thestartposition, and the data is copied from thedataarray to the table.The indexes
start, …,start+data.count-1must be valid indexes of this table.Declaration
Swift
public func setData(_ data: [Double], start: Int) throwsParameters
dataarray holding the data to copy to this table
startindex of the first element to be set
-
Sets a specific data item of the discrete data of this
Table.Declaration
Swift
public func setDataItem(_ index: Int, _ value: Double) throwsParameters
indexindex of the data item to set
valuethe new value of the data item at the specified index.
-
Returns the mean of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this
Table.Declaration
Swift
public func getMean(_ index: Int, _ node: Node) throws -> DoubleParameters
indexthe index of the discrete configuration.
nodeThe continuous chance node in question.
Return Value
A double-precision real value.
-
Returns the variance of a ContinuousChanceNode given a configuration of the discrete chance Nodes of this
Table.Declaration
Swift
public func getVariance(_ index: Int, _ node: Node) throws -> DoubleParameters
indexthe index of the discrete configuration.
nodethe continuous chance node in question.
Return Value
A double-precision real value.
-
Returns the covariance of a couple of ContinuousChanceNodes given a configuration of the discrete chance Nodes of this
Table.Declaration
Parameters
indexthe index of the discrete configuration.
node1one of the continuous chance nodes in question.
node2the other continuous chance node.
Return Value
A double-precision real value.
-
Computes the probability of the given interval for the mixture distribution represented by this
Table.The table must have been computed by
Node.getDistribution().Declaration
Swift
public func computeProbabilityOfInterval (_ x: Double, _ y: Double) throws -> DoubleParameters
xthe left endpoint of the interval.
ythe right endpoint of the interval.
-
Reorders the list of Nodes of this
Table.Declaration
Swift
public func reorderNodes(_ nodes: [Node]) throwsParameters
nodesthe new order (which must be a permutation of the current order) of the Nodes of this
Table. -
Deletes this
Table.Note: Application-owned tables (such as those created by
Domain.getMarginalandNode.getDistribution) are automatically deleted when all references to the table disappear (scope ends ornilis assigned to theTablevariable). This means that it is rarely neccessary to explicitly delete a table (exceptions could be experience and fading tables, used by adaptation and the EM algorithm).Declaration
Swift
public func delete() throws -
Is this
Tableobject alive?Declaration
Swift
public func isAlive() -> Bool
Table Class Reference