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 Table is 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 configuration array: A state index for the k'th (discrete) node in the node list of this Table must 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 this Table (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 a start position and the number of elements (count) to copy. The data is copied to the data array. 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-1 must be valid indexes of this table. Also, count must be less than or equal to the size of the data array.

    Declaration

    Swift

    public func getData(start: Int, count: Int) throws -> [Double]

    Parameters

    data

    array to hold the extracted data

    start

    index of the first element to copy

    count

    number of elements to copy

  • Returns the data item at position index of the discrete data of this Table. 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 -> Double

    Parameters

    index

    the 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 the data array are copied to the table. The size of the array must equal the size of the table.

    Declaration

    Swift

    public func setData(_ data: [Double]) throws

    Parameters

    data

    array holding the data to copy to the table

  • Sets a region of the discrete data of this Table. The region is specified by the start position, and the data is copied from the data array to the table.

    The indexes start, …, start+data.count-1 must be valid indexes of this table.

    Declaration

    Swift

    public func setData(_ data: [Double], start: Int) throws

    Parameters

    data

    array holding the data to copy to this table

    start

    index 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) throws

    Parameters

    index

    index of the data item to set

    value

    the 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 -> Double

    Parameters

    index

    the index of the discrete configuration.

    node

    The 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 -> Double

    Parameters

    index

    the index of the discrete configuration.

    node

    the 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

    Swift

    public func getCovariance (_ index: Int, _ node1: Node, _ node2: Node)
    throws -> Double

    Parameters

    index

    the index of the discrete configuration.

    node1

    one of the continuous chance nodes in question.

    node2

    the 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 -> Double

    Parameters

    x

    the left endpoint of the interval.

    y

    the right endpoint of the interval.

  • Reorders the list of Nodes of this Table.

    Declaration

    Swift

    public func reorderNodes(_ nodes: [Node]) throws

    Parameters

    nodes

    the 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.getMarginal and Node.getDistribution) are automatically deleted when all references to the table disappear (scope ends or nil is assigned to the Table variable). 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 Table object alive?

    Declaration

    Swift

    public func isAlive() -> Bool