Domain

public class Domain : Network

Instances of the Domain class represent Bayesian networks and LIMIDs in which you can propagate evidence and calculate updated beliefs and expected utilities.

Domain objects are automatically deallocated when the last reference to the object disappears. When this happens, all objects “owned” by the Domain object (such as Node objects) are deleted, so make sure to hold on to the Domain object until it is no longer needed.

  • Constructs a new empty Domain.

    Declaration

    Swift

    public init(license: License? = nil) throws

    Parameters

    license

    license data to be used instead of a license file.

  • Constructs a Domain by loading the corresponding Hugin Knowledge Base (HKB) file. The HKB file must contain a domain.

    Declaration

    Swift

    public init(hkbName: String, password: String? = nil, license: License? = nil) throws

    Parameters

    hkbName

    the name of the HKB file

    password

    a password needed to load the file

    license

    license data to be used instead of a license file.

  • Saves this Domain as a Hugin Knowledge Base (HKB) file. If password is non-nil, the file will be password protected. This password must be used in order to load the file.

    Declaration

    Swift

    public func save(hkbName: String, password: String? = nil) throws

    Parameters

    hkbName

    the name of the HKB file to create

    password

    if non-nil, this must be used in order to load the HKB file.

  • Constructs a Domain from a NET file.

    Declaration

    Swift

    public init(netName: String, license: License? = nil) throws

    Parameters

    netName

    the name of the NET file

    license

    license data to be used instead of a license file.

  • Constructs a Domain from a NET description provided as a string.

    Declaration

    Swift

    public init(netString: String, license: License? = nil) throws

    Parameters

    netString

    the NET description

    license

    license data to be used instead of a license file.

  • Constructs a runtime domain from a Class object.

    Declaration

    Swift

    public init(_ cls: Class) throws

    Parameters

    cls

    the Class object to instantiate.

  • Constructs a DBN runtime domain from a Class object. The domain is formed by linking (through temporal clones) the specified number of instances (called time slices) of the class.

    Declaration

    Swift

    public init(_ cls: Class, _ numberOfSlices: Int) throws

    Parameters

    cls

    the Class object describing a single time slice

    numberOfSlices

    the number of time slices

  • Constructs a domain by cloning the given Domain object.

    Declaration

    Swift

    public init(_ domain: Domain) throws

    Parameters

    domain

    the Domain object to clone.

  • The TriangulationMethod type represents the triangulation method used for this Domain. Triangulation is the process of transforming the graph of a Domain to a triangulated graph, which forms the basis for constructing the JunctionTree of the Domain.

    See more

    Declaration

    Swift

    public enum TriangulationMethod
  • Triangulates the graph of this Domain using the specified triangulation method.

    Declaration

    Swift

    public func triangulate(_ tm: TriangulationMethod) throws

    Parameters

    tm

    the TriangulationMethod to use.

  • Triangulates the graph of this Domain using the specified elimination order. The elimination order must contain each chance and decision node of this Domain exactly once, and continuous nodes must appear before discrete nodes.

    Declaration

    Swift

    public func triangulate(_ order: [Node]) throws

    Parameters

    order

    a NodeList containing the Nodes of the network in the order of elimination

  • Returns the triangulation order. A NodeList containing the nodes in the order used to triangulate the network of this Domain is returned.

    Declaration

    Swift

    public func getEliminationOrder() throws -> [Node]

    Return Value

    NodeList containing Nodes representing the elimination order used.

  • Tests whether this Domain is triangulated. Being “triangulated” means that the junction forest has been created, but not the associated tables.

    Declaration

    Swift

    public func isTriangulated() throws -> Bool
  • Compiles this Domain. The domain must not be compiled. The default triangulation method is used (unless the domain is already triangulated, in which case the existing triangulation is used).

    Declaration

    Swift

    public func compile() throws
  • Tests whether this Domain is compiled. A domain is “compiled” if it is triangulated and junction tree tables are created.

    Declaration

    Swift

    public func isCompiled() throws -> Bool
  • Uncompiles this Domain. Removes the data structures of the Domain produced by a triangulation or a compilation. Note that any references to objects within the compiled structure (e.g., Cliques and JunctionTrees) are invalidated (that is, any attempt to access the objects will throw an object-not-alive exception). Also note that many of the editing functions automatically performs an uncompile() operation. When this happens, the domain must be compiled again before it can be used for inference.

    Declaration

    Swift

    public func uncompile() throws
  • Sets an initial triangulation for this Domain for use by the totalWeight triangulation method. The purpose is to (1) improve the generated triangulation, and (2) to reduce the run-time of the algorithm. The triangulation must be specified in the form of an elimination sequence.

    Declaration

    Swift

    public func setInitialTriangulation(_ order: [Node]) throws

    Parameters

    order

    a list of Nodes of the network in the order of elimination.

  • Sets the maximum number of separators allowed when using the totalWeight triangulation method. No value (nil) specifies an unbounded number of separators.

    Declaration

    Swift

    public func setMaxNumberOfSeparators(_ m: Int?) throws
  • Sets the maximum separator size for the totalWeight triangulation method. If a maximum separator size is specified, then separators larger than the specified size will be discarded by the separator generation algorithm. However, separators implied by the initial triangulation will be retained (regardless of size). This feature can be used to triangulate much larger graphs (without splitting them into smaller subgraphs). But notice that not all separators up to the specified limit are necessarily generated.

    An initial triangulation is required in order to use this feature.

    If no maximum size (nil) is specified, then no separators will be discarded.

    See also

    Domain.setInitialTriangulation([Node])

    Declaration

    Swift

    public func setMaxSeparatorSize(_ size: Int?) throws
  • Returns the maximum number of separators allowed when using the totalWeight triangulation method.

    See also

    Domain.setMaxNumberOfSeparators(Int?)

    Declaration

    Swift

    public func getMaxNumberOfSeparators() throws -> Int?
  • Returns the maximum separator size allowed when using the totalWeight triangulation method.

    See also

    Domain.setMaxSeparatorSize(Int?)

    Declaration

    Swift

    public func getMaxSeparatorSize() throws -> Int?
  • Removes “near-zero” probabilities from the clique probability tables. For each Clique in this domain, a value delta is computed such that the sum of all elements less than delta in the (discrete part) of the clique table is less than epsilon. These elements (less than delta) are then set to 0.

    Declaration

    Swift

    public func approximate(_ epsilon: Double) throws -> Double

    Parameters

    epsilon

    the threshold value. Maximal probability mass to eradicate from each clique.

    Return Value

    The probability mass remaining in the entire Domain, letting you know how much precision you have “lost”. Note that this is not the same as 1 - e, as the e value is relative to each clique. Typically, the amount of probability mass removed will be somewhat larger than e.

  • Returns the approximation constant. The number returned is based on the most recent (explicit or implicit) approximation operation. An implicit approximation takes place when you change some conditional probability tables of a compressed domain, and then perform a propagation operation. Since some (discrete) state configurations have been removed from a compressed domain, the probability mass of the remaining configurations will typically be less than 1. This probability mass is returned by getApproximationConstant().

    Declaration

    Swift

    public func getApproximationConstant() throws -> Double

    Return Value

    A real number expressing the probability mass remaining in the approximated domain.

  • Removes the zero entries from the clique and separator tables of the JunctionTrees in this Domain. Compression can only be applied to (compiled) ordinary Bayesian networks. Continuous nodes are allowed, but compression only applies to configurations of states of the discrete nodes.

    Declaration

    Swift

    public func compress() throws -> Double

    Return Value

    A double value which indicates a measure of compression achieved. The measure should be less than 1, indicating that the compressed Domain requires less space than the uncompressed Domain. An output greater than 1 means that the “compressed” Domain requires more space than the uncompressed Domain.

  • Tests whether this Domain is compressed.

    Declaration

    Swift

    public func isCompressed() throws -> Bool
  • Returns the JunctionTrees of this Domain.

    Declaration

    Swift

    public func getJunctionTrees() throws -> [JunctionTree]
  • Retracts (all) evidence for all nodes in this Domain.

    Declaration

    Swift

    public func retractFindings() throws
  • Performs a d-separation test and returns a list of d-connected nodes. Assuming evidence on the specified evidence nodes, this method returns the list of nodes that are d-connected to the specified list of source nodes.

    Declaration

    Swift

    public func getDConnectedNodes (source: [Node], hard: [Node],
    				soft: [Node] = [])
    throws -> [Node]

    Parameters

    source

    list of source nodes

    hard

    list of nodes assumed to be instantiated

    soft

    list of nodes assumed to have multi-state or likelihood evidence.

    Return Value

    the list of d-connected nodes

  • Performs a d-separation test and returns a list of d-separated nodes. Assuming evidence on the specified evidence nodes, this method returns the list of nodes that are d-separated to the specified list of source nodes.

    Declaration

    Swift

    public func getDSeparatedNodes (source: [Node], hard: [Node],
    				soft: [Node] = [])
    throws -> [Node]

    Parameters

    source

    list of source nodes

    hard

    list of nodes assumed to be instantiated

    soft

    list of nodes assumed to have multi-state or likelihood evidence.

    Return Value

    the list of d-separated nodes

  • Computes the marginal distribution for the Nodes provided as argument with respect to the (imaginary) joint potential, determined by the current potentials on the JunctionTree(s) of this Domain. If nodes contains continuous nodes, they must be last in the list. This operation is not allowed on compressed Domains.

    Declaration

    Swift

    public func getMarginal(_ nodes: [Node]) throws -> Table

    Parameters

    nodes

    a NodeList containing the Nodes over which to compute the marginal.

    Return Value

    A Table containing the marginal distribution over the Nodes in nodes.

  • Returns the total expected utility associated with this Domain.

    Declaration

    Swift

    public func getExpectedUtility() throws -> Double
  • Parses the case stored in file fileName and enters the associated findings into this Domain. All existing evidence in the Domain is retracted before entering the case findings.

    Declaration

    Swift

    public func parseCase (_ fileName: String)
    throws

    Parameters

    fileName

    the name of the file containing the case.

  • Saves all evidence entered in this Domain in file fileName (if the file exists, it is overwritten).

    Declaration

    Swift

    public func saveCase(_ fileName: String) throws

    Parameters

    fileName

    the name of the file in which the case is going to be saved.

  • The Equilibrium type represents the equilibrium state of this Domain.

    See more

    Declaration

    Swift

    public enum Equilibrium
  • The EvidenceMode type represents the mode used for propagating evidence in this Domain.

    See more

    Declaration

    Swift

    public enum EvidenceMode
  • Establishes the specified equilibrium using the evidence mode indicated for incorporation of evidence on all JunctionTrees of this Domain. Also, revised beliefs will be computed for all nodes.

    Declaration

    Swift

    public func propagate (equilibrium: Equilibrium = .sum,
    mode: EvidenceMode = .normal) throws

    Parameters

    equilibrium

    The type of equilibrium to establish. The default type is Domain.Equilibrium.sum.

    mode

    The evidence mode to use. The default mode is Domain.EvidenceMode.normal.

  • Tests for Equilibrium type. Returns true if the equilibrium states of all JunctionTrees of this Domain are identical to equilibrium.

    Declaration

    Swift

    public func equilibriumIs(_ equilibrium: Equilibrium) throws -> Bool

    Parameters

    equilibrium

    the type of equilibrium to test for.

  • Tests for evidence mode. Returns true if the equilibrium states of all JunctionTrees of this Domain could have been obtained through a propagation using evidenceMode as the evidence incorporation mode. Otherwise, returns false.

    Declaration

    Swift

    public func evidenceModeIs(_ evidenceMode: EvidenceMode) throws -> Bool

    Parameters

    evidenceMode

    the type of EvidenceMode to test for.

  • Updates the policy tables of the domain. The policies of all unmade decisions are updated. The new policies maximize the overall expected utility.

    Declaration

    Swift

    public func updatePolicies() throws
  • Retrieves the normalization constant for the most recent propagation. For sum-propagation, the normalization constant is equal to the probability of the evidence propagated. For max-propagation, the normalization constant is the probability of the most probable configuration with the evidence incorporated.

    Declaration

    Swift

    public func getNormalizationConstant() throws -> Double
  • Returns the logarithm of the normalization constant.

    Declaration

    Swift

    public func getLogNormalizationConstant() throws -> Double
  • Returns the conflict value. The conflict value is valid for this Domain computed during the most recent propagation. If no propagation has been performed, 1 is returned.

    Declaration

    Swift

    public func getConflict() throws -> Double

    Return Value

    A double-precision real value expressing the conflict measure in the domain.

  • Creates a copy in memory of the belief and JunctionTree tables of this Domain. This operation can only be performed if the domain is compiled, the current equilibrium equals Domain.Equilibrium.sum, and no evidence has been incorporated.

    Declaration

    Swift

    public func saveToMemory() throws
  • Establishes the initial state of the inference engine, which is sum-equilibrium with no evidence incorporated. Any propagated evidence will thus be removed from the JunctionTree potentials, but entered evidence will still be “registered” (i.e., they will be incorporated in the next propagation).

    Declaration

    Swift

    public func resetInferenceEngine() throws
  • Establishes the initial values for all tables of this Domain (which must be compiled). This method erases all evidence previously entered.

    Declaration

    Swift

    public func initialize() throws
  • Tests if evidence has been propagated for this Domain. Returns true if it has; otherwise, returns false.

    Declaration

    Swift

    public func evidenceIsPropagated() throws -> Bool
  • Tests if evidence has been entered since the last propagation. Returns true if it has; otherwise, returns false.

    Declaration

    Swift

    public func evidenceToPropagate() throws -> Bool
  • Tests if likelihood evidence has been propagated for this Domain. Returns true if it has; otherwise, returns false.

    Declaration

    Swift

    public func likelihoodIsPropagated() throws -> Bool
  • Returns true if evidence on CG nodes has been propagated; otherwise, returns false.

    Declaration

    Swift

    public func cgEvidenceIsPropagated() throws -> Bool
  • Tests for new node tables. Returns true if there is a node in this Domain having a (conditional probability, policy, or utility) table that has changed since the most recent compilation or propagation; otherwise, returns false.

    Declaration

    Swift

    public func tablesToPropagate() throws -> Bool
  • Generates a sample configuration from the joint distribution represented by this Domain. Given evidence, we may be interested in generating (sampling) configurations (i.e., vectors of values over the set of variables in the network) with respect to the conditional distribution for the evidence. If the Domain is compiled, a configuration is sampled with respect to the current distribution represented by the JunctionTree(s). This distribution must be in sum-equilibrium with evidence incorporated in normal mode.

    Declaration

    Swift

    public func simulate() throws
  • Seeds the pseudo-random number generator for this Domain. The configurations generated by simulate are not really random. They are generated using a pseudo-random number generator producing a sequence of numbers that although it appears random is actually completely deterministic. To change the starting point for the generator, use this method.

    Declaration

    Swift

    public func seedRandom(_ seed: UInt32) throws

    Parameters

    seed

    the seed number.

  • Use the pseudo-random number generator for this Domain to sample a real number from the uniform distribution over the interval [0,1).

    Declaration

    Swift

    public func getUniformDeviate() throws -> Double
  • Use the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution.

    Declaration

    Swift

    public func getNormalDeviate (_ mean: Double, _ variance: Double)
    throws -> Double

    Parameters

    mean

    the mean of the distribution

    variance

    the variance of the distribution

  • Computes the constants of the sensitivity functions for the specified output probabilities and all CPT parameters in the network. The output probabilities are specified using a list of (discrete chance) nodes and a list of corresponding states.

    Declaration

    Swift

    public func computeSensitivityData (_ nodes: [Node], _ states: [Int])
    throws

    Parameters

    nodes

    the list of (output) nodes

    states

    a list of states of the nodes in the nodes list

  • Returns the sensitivity set computed by the most recent call to Node.computeSensitivityData(Int). If the results produced by that call have been invalidated, a usage error is thrown.

    Declaration

    Swift

    public func getSensitivitySet() throws -> [Node]
  • Returns the sensitivity set computed by the most recent call to Domain.computeSensitivityData([Node],[Int]). If the results produced by that call have been invalidated, a usage error is thrown.

    Declaration

    Swift

    public func getSensitivitySet(_ output: Int) throws -> [Node]

    Parameters

    output

    identifies one of the output probabilities specified in the call to Domain.computeSensitivityData([Node],[Int]).

  • Finds all configurations of nodes with probability at least minProbability. This method uses a Monte Carlo algorithm to solve a generalized form of the maximum a posteriori (MAP) configuration problem: The MAP configuration problem is the problem of finding the most probable configuration of a set of nodes given evidence on some of the remaining nodes.

    The results of this method are provided by Domain.getNumberOfMAPConfigurations(), Domain.getMAPConfiguration(Int), and Domain.getProbabilityOfMAPConfiguration(Int).

    Declaration

    Swift

    public func findMAPConfigurations (_ nodes: [Node], _ minProbability: Double)
    throws

    Parameters

    nodes

    a list of discrete nodes for which to find configurations.

    minProbability

    configurations with a lower probability than minProbability are ignored.

  • Returns the number of MAP configurations. This method returns the number of configurations found by the most recent successful call to Domain.findMAPConfigurations([Node],Double).

    Declaration

    Swift

    public func getNumberOfMAPConfigurations() throws -> Int
  • This method returns the MAP configuration identified by index among the configurations with probability at least minProbability — as specified in the most recent successful call to Domain.findMAPConfigurations([Node],Double).

    The index argument must be a nonnegative integer less than the number of MAP configurations found: 0 requests the most probable configuration, 1 the second-most probable configuration, etc.

    Declaration

    Swift

    public func getMAPConfiguration(_ index: Int) throws -> [Int]

    Parameters

    index

    identifies the configuration.

    Return Value

    an array of state indexes forming the configuration.

  • This method returns the probability of the MAP configuration returned by Domain.getMAPConfiguration(index).

    Declaration

    Swift

    public func getProbabilityOfMAPConfiguration (_ index: Int)
    throws -> Double

    Parameters

    index

    identifies the configuration.

    Return Value

    the probability of the specified configuration.

  • Returns the number of explanations. This method returns the number of subsets found by the most recent successful call to Node.computeExplanationData(Int,Node,Int,Int).

    Declaration

    Swift

    public func getNumberOfExplanations() throws -> Int
  • Returns the evidence subset associated with the explanation of rank index computed by the most recent call to Node.computeExplanationData(Int,Node,Int,Int).

    Declaration

    Swift

    public func getExplanation(_ index: Int) throws -> [Node]

    Parameters

    index

    specifies that the indexth best explanation should be retrieved (the best explanation has index 0, the second best has index 1, etc.)

  • Returns the score of the specified explanation. This method returns the score associated with the explanation subset returned by Domain.getExplanation(index).

    Declaration

    Swift

    public func getExplanationScore(_ index: Int) throws -> Double

    Parameters

    index

    identifies the explanation.

  • Adapts this Domain according to the evidence propagated.

    Declaration

    Swift

    public func adapt() throws
  • Adapts (using the Fractional Update algorithm) the tables of the nodes in the class with the evidence propagated in this runtime Domain. This method must be called on a runtime domain. The evidence propagated in this domain is used to adapt the tables of the class from which this domain was created. The updated tables are copied back to the nodes of the runtime domain.

    Declaration

    Swift

    public func adaptClassTablesUsingFractionalUpdate() throws
  • Adapts (using the Online EM algorithm) the tables of the nodes in the class with the evidence propagated in this runtime Domain. This method must be called on a runtime domain. The evidence propagated in this domain is used to adapt the tables of the class from which this domain was created. The updated tables are copied back to the nodes of the runtime domain.

    Declaration

    Swift

    public func adaptClassTablesUsingOnlineEM(_ rho: Double) throws

    Parameters

    rho

    the parameter used to determine the “learning rate” of the Online EM algorithm.

  • Sets the number of cases.

    Declaration

    Swift

    public func setNumberOfCases(_ size: Int) throws
  • Creates a new case.

    Declaration

    Swift

    public func newCase() throws -> Int

    Return Value

    the index of the new case

  • Returns the number of data cases.

    Declaration

    Swift

    public func getNumberOfCases() throws -> Int
  • Sets case count for a case.

    Declaration

    Swift

    public func setCaseCount(_ index: Int, _ count: Double) throws

    Parameters

    index

    the index of the case for which to set the count.

    count

    the multiplicity of case index.

  • Returns case count for a case.

    Declaration

    Swift

    public func getCaseCount(_ index: Int) throws -> Double

    Parameters

    index

    the index of the case for which to get the count.

    Return Value

    The multiplicity of case index.

  • Enters a case as evidence.

    Declaration

    Swift

    public func enterCase(_ index: Int) throws

    Parameters

    index

    the index of the case to enter.

  • Parses the cases stored in file fileName and enters the cases into this Domain.

    Declaration

    Swift

    public func parseCases (_ fileName: String)
    throws

    Parameters

    fileName

    the name of the file containing the cases.

  • Saves all cases entered in this Domain in a file with the given fileName (if the file exists, it is overwritten).

    Declaration

    Swift

    public func saveCases (_ fileName: String, _ nodes: [Node],
    _ cases: [Int]? = nil,
    includeCaseCounts: Bool = false, separator: String = ",",
    missingData: String = "*") throws

    Parameters

    fileName

    the name of the file in which the cases will be saved.

    nodes

    A list of all nodes which are to be included in the file

    cases

    An array of case indexes specifying the cases to be included in the file. Passing nil for this argument will include all cases.

    includeCaseCounts

    If true, include case counts in the data file. If false, only include case counts if they are present in the domain.

    separator

    The string used to seperate the items in the file

    missingData

    The string used to represent missing data

  • Computes the log-likelihood of the case data.

    Declaration

    Swift

    public func getLogLikelihood() throws -> Double
  • Computes the AIC score (Akaike’s Information Criterion) of the case data.

    Declaration

    Swift

    public func getAIC() throws -> Double
  • Computes the BIC score (Bayesian Information Criterion) of the case data.

    Declaration

    Swift

    public func getBIC() throws -> Double
  • Learn the structure (graph) of the Bayesian network from data using the PC-algorithm.

    The domain must contain only chance nodes and no edges. Case data must be specified in advance.

    Declaration

    Swift

    public func learnStructure() throws
  • Learns a tree-structured network model from data. If root is non-nil, then a Chow-Liu tree model with root as root is learned. Then, if target is also non-nil, this tree is turned into a TAN model by adding target as parent of all other nodes of this Domain. If root and target are both nil, then a Rebane-Pearl polytree model is learned.

    The domain must contain only chance nodes and no edges. Case data must be specified in advance.

    Declaration

    Swift

    public func learnTreeStructure (root: Node? = nil, target: Node? = nil)
    throws

    Parameters

    root

    all edges of the Chow-Liu tree will be directed away from root

    target

    the class variable of the TAN model.

  • Sets the significance level of the dependency tests performed during structure learning using the PC-algorithm. The default value is 0.05.

    Declaration

    Swift

    public func setSignificanceLevel(_ alpha: Double) throws

    Parameters

    alpha

    the significance level.

  • Returns the significance level of the dependency tests performed during structure learning using the PC-algorithm. The default value is 0.05.

    Declaration

    Swift

    public func getSignificanceLevel() throws -> Double

    Return Value

    A positive double.

  • Learns the conditional probability tables from data using the EM algorithm.

    Declaration

    Swift

    public func learnTables() throws
  • Learns the conditional probability tables of the class nodes, from which the domain is created, from data using the EM algorithm.

    Declaration

    Swift

    public func learnClassTables() throws
  • Sets the log-likelihood tolerance for this Domain.

    Declaration

    Swift

    public func setLogLikelihoodTolerance(_ tolerance: Double) throws
  • Returns the log-likelihood tolerance for this Domain.

    Declaration

    Swift

    public func getLogLikelihoodTolerance() throws -> Double
  • Sets the maximum number of iterations allowed for the EM algorithm. No value (nil) specifies an unbounded number of iterations.

    Declaration

    Swift

    public func setMaxNumberOfEMIterations(_ m: Int?) throws
  • Returns the maximum number of iterations allowed for the EM algorithm.

    Declaration

    Swift

    public func getMaxNumberOfEMIterations() throws -> Int?
  • Triangulates a DBN runtime Domain for exact inference.

    Declaration

    Swift

    public func triangulateDBN(_ tm: TriangulationMethod) throws

    Parameters

    tm

    the TriangulationMethod to use.

  • Triangulates a DBN runtime Domain for approximate inference. Boyen-Koller approximate inference is applied to the interfaces between the time slices of the time window.

    Declaration

    Swift

    public func triangulateDBNForBK(_ tm: TriangulationMethod) throws

    Parameters

    tm

    the TriangulationMethod to use.

  • Tests whether this Domain is triangulated for Boyen-Koller approximate inference.

    Declaration

    Swift

    public func isTriangulatedForBK() throws -> Bool
  • Slides the time window of this DBN delta steps into the future. This Domain must have been produced by Domain.init(Class,Int), and it must have been triangulated using Domain.triangulateDBN(TriangulationMethod).

    Declaration

    Swift

    public func moveDBNWindow(_ delta: Int) throws

    Parameters

    delta

    the number of time steps to slide the time window (this must be a positive number).

  • Returns the total number of time steps that the time window of this DBN runtime domain has been moved.

    Declaration

    Swift

    public func getDBNWindowOffset() throws -> Int
  • Moves the time window of this DBN back to its initial position, and removes all evidence. This Domain must have been produced by Domain.init(Class,Int), and it must have been triangulated using Domain.triangulateDBN(TriangulationMethod).

    Declaration

    Swift

    public func initializeDBNWindow() throws
  • Computes predictions for numberOfTimePoints time slices beyond the current time window. This Domain must have been produced by Domain.init(Class,Int), and it must have been triangulated using Domain.triangulateDBN(TriangulationMethod). The predictions are accessed using Node.getPredictedBelief(Int,Int), Node.getPredictedMean(Int),Node.getPredictedVariance(Int), andNode.getPredictedValue(Int)`.

    Declaration

    Swift

    public func computeDBNPredictions(_ numberOfTimePoints: Int) throws

    Parameters

    numberOfTimePoints

    the number of time slices to compute predictions for (this must be a positive number).

  • Adds the specified range of rows of the data set to this Domain as cases.

    Declaration

    Swift

    public func addCases(_ dataSet: DataSet, start: Int, count: Int) throws

    Parameters

    start

    the index of the first row to add

    count

    the number of rows to add.

  • Adds all rows of the data set to this Domain as cases.

    Declaration

    Swift

    public func addCases(_ dataSet: DataSet) throws
  • Sets the level of concurrency. The level of concurrency specifies the maximum number of threads to create when performing a specific table operation. Setting the level of concurrency to 1 will cause all table operations to be performed sequentially. The initial parameter value is 1.

    Declaration

    Swift

    public func setConcurrencyLevel(_ level: Int) throws

    Parameters

    level

    the level of concurrency.

  • Sets the grain size parameter. The grain size parameter specifies a lower limit of the tasks to be performed by each thread. The size of a task is approximately equal to the number of floating-point operations needed to perform the task (e.g. the number of elements to sum when performing a marginalization task).

    The initial value of the grain size parameter is 10000.

    Declaration

    Swift

    public func setGrainSize(_ size: Int) throws

    Parameters

    size

    the grain size.

  • Gets the current level of concurrency.

    See also

    Domain.setConcurrencyLevel

    Declaration

    Swift

    public func getConcurrencyLevel() throws -> Int

    Return Value

    A positive integer.

  • Returns the current value of the grain size parameter.

    Declaration

    Swift

    public func getGrainSize() throws -> Int

    Return Value

    A positive integer.