The JavaScript for HUGIN Web Service API provides a scripting interface to the HUGIN Web Service API for using HUGIN in a browser context. The API is a wrapper for the functionality provided by the HUGIN Web Service API, and translates any function calls into proper HTTP requests for exercising the remote decision engine and throwing errors appropriately when a function call fails.
Due to limitations imposed by the browser security model, cross-origin HTTP requests are not supported in full. This means that the JavaScript for HUGIN Web Service API can only bind to the HUGIN Web Service API iff the webpage which the script is running on and the HUGIN Web Service API is served from the same host (hostname+port). This means that a simple proxy must be set up such that the web server which serves the web page forwards any HUGIN requests to the correct host/port serving the HUGIN Web Service API.
As any function invocation results in a HTTP request, the result of any idempotent function call is cached. The cache is wiped when invoking a function with side effects. Note: If the state of any resource is updated outside of javascript code, it is imperative to wipe the cache in order to reflect updated state (see HAPI.refetch).
<?php //NOTE: //Apache AcceptPathInfo directive must be set to 'on' in order for this script to work! //php.ini must have allow_url_fopen = On //Address of HUGIN Web Service which request should be forwarded to $WEBSERVICE_HOST = "127.0.0.1"; $WEBSERVICE_PORT = 8080; $url = substr($_SERVER['REQUEST_URI'], strlen($_SERVER["SCRIPT_NAME"])); $request_method = $_SERVER['REQUEST_METHOD']; if ($request_method == 'GET' || $request_method == 'POST') { @$fp = fsockopen($WEBSERVICE_HOST, $WEBSERVICE_PORT, $errno, $errstr, 30); if (!$fp) { header("HTTP/1.1 404 Bad Request"); echo "$errstr ($errno)<br />\n"; } else { $out = ''; if ($request_method == 'GET') $out .= "GET " . $url . " HTTP/1.1\r\n"; else $out .= "POST " . $url . " HTTP/1.1\r\n"; $out .= "Host: " . $WEBSERVICE_HOST . "\r\n"; foreach (getallheaders() as $name => $value) { if ($name != "Connection" && $name != "Host") $out .= "$name: $value\r\n"; } $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); if ($request_method == 'POST') fwrite($fp, file_get_contents('php://input')); $emptylines = 0; while (!feof($fp)) { $hs = fgets($fp, 128); if ($hs != "\r\n") { header($hs, true); } else { $emptylines++; if ($emptylines==1) break; } } $contents = ''; while (!feof($fp)) $contents .= fread($fp, 8192); fclose($fp); echo $contents; } } ?>
To use the JavaScript for HUGIN Web Service API the .js library must be included. Add the following to the <HEAD></HEAD> part of the HTML page (“/webservice/hugin.php” is the path to the HUGIN proxy script introduced above):
<head> .. <script src="/webservice/hugin.php/hugin.js" type="text/javascript"></script> .. </head>
The HUGIN library can then be exercised within any <script></script> tag:
<body> .. <script type="text/javascript"> try { //create a new HAPI instance hapi = new HAPI("/webservice/hugin.php"); //create a new Domain instance domain = hapi.getNewDomain(); //create a node in the domain A = domain.getNewNode(HAPI.H_CATEGORY_CHANCE, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_NUMBER); A.setName("A"); A.setNumberOfStates(3); A.setStateValue(0, 10); A.setStateValue(1, 20); A.setStateValue(2, 30); .. } catch (e) { alert("An error occurred: " + e.name + "\n" + e.message); } </script> .. </body>
For information on using HUGIN Widgets in conjunction with the JavaScript for HUGIN Web Service API on a web page see HUGIN Widgets Library.
When a HUGIN function invocation fails an error object is thrown. Errors may be thrown due to a number of reasons such as pre-conditions for invoking the function was not met, wrong parameters, the HUGIN object may have already been deleted/garbage collected etc. Catching and dealing with error objects is a natural part of exercising the JavaScript for HUGIN Web Service API.
Invocation of HUGIN functions should be appropriately wrapped in error handling code using the try/catch JavaScript construct. Any error object can be inspected by looking at the error.name and error.message members.
try { //code that invoke HUGIN function } catch (e) { //deal with this error condition }
JavaScript for HUGIN Web Service API | The JavaScript for HUGIN Web Service API provides a scripting interface to the HUGIN Web Service API for using HUGIN in a browser context. |
HAPI | The HAPI class is a container for all functionality in the JavaScript for HUGIN Web Service API. |
Functions | |
HAPI | Initializes a new instance of the HAPI class and binds it internally to the RESTful HUGIN Web Service API. |
getNewClassCollection | Construct an empty classcollection. |
loadClassCollection | Construct a classcollection from a HUGIN Knowledge Base retrieved over HTTP. |
loadDomain | Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL. |
loadCompileDomain | Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL. |
getNewDomain | Constructs a new empty Domain. |
loadDataSet | Instantiate a DataSet from a CSV file retrieved over HTTP. |
getNewDataSet | Construct an empty DataSet. |
refetch | Refetch cached responses from remote decision engine. |
getNewBatch | Constructs a new Batch object. |
Batch | A Batch can be used to group together a sequence of batchable function calls and then carry out the function calls using a single HTTP request - effectively saving the round-trip-time delay of having to perform individual HTTP requests for each function. |
Functions | |
getHAPI | Get the HAPI object that owns this Batch |
reset | Reset the Batch. |
add | Add a function call to the Batch queue. |
execute | Execute the queued up function calls in a synchronously blocking fashion. |
dispatch | Dispatch execution of queued up function calls in an asynchronously non-blocking fashion. |
ClassCollection | Classes are grouped into ClassCollections. |
Functions | |
getHAPI | Get the HAPI object that owns this ClassCollection |
deleteObject | Deletes this ClassCollection object, including all nested HUGIN objects belonging to it (e.g. |
getClassByName | Returns a Class by name. |
getMembers | Get all Classes of this ClassCollection. |
save | Submits this ClassCollection in the form of a HKB file to the service located at a target URL. |
download | Generate an URL for downloading this ClassCollection as a HKB file |
getNewClass | Creates a new Class. |
NetworkModel | NetworkModel interface is implemented by Class and Domain. |
Functions | |
getHAPI | Get the HAPI object that owns this NetworkModel |
getNodeByName | Returns a Node by name. |
getNewNode | Creates a new Node. |
getNodes | Get all Nodes in this NetworkModel. |
generateTables | Generates the conditional probability tables for all nodes of this NetworkModel. |
getAttribute | Returns an attribute value. |
parseNodes | Parses the file retrieved from an URL and returns a list of Nodes. |
setAttribute | Inserts the key/value pair in the attribute list for this NetworkModel. |
Class | Instances of Class represent object-oriented Bayesian networks and LIMIDs. |
Functions | |
deleteObject | Deletes this Class, including all Node objects belonging to it. |
createDBNDomain | Creates a DBN runtime Domain from this Class. |
createDomain | Creates a flat runtime Domain from this Class. |
getNewInstanceNode | Creates a new instance Node. |
getClassCollection | Get the ClassCollection to which this Class belongs. |
getInputs | Get all input Nodes defined for this Class. |
getInstances | Get all instance Nodes that are instances of this Class. |
getOutputs | Get all output Nodes defined for this Class. |
getName | Returns the name of this Class. |
setName | Sets the name of this Class. |
Domain | Instances of the Domain class represent Bayesian networks and LIMIDs in which you can propagate evidence and calculate updated beliefs and expected utilities. |
Functions | |
deleteObject | Deletes this Domain, including all Node and JunctionTree objects belonging to it. |
parseCase | Parses a case retrieved from an URL and enters the associated findings into this Domain. |
saveCase | Submits all evidence entered in this Domain to the service located at a target URL. |
save | Submits this Domain in the form of a HKB file to the service located at a target URL. |
download | Generate an URL for downloading this Domain as a HKB file |
parseCases | Parses the cases retrieved form an URL and enters the cases into this Domain. |
saveCases | Submits all cases in this Domain to the service located at a target URL. |
propagate | Establishes the specified equilibrium using the evidence mode indicated for incorporation of evidence on all JunctionTrees of this Domain. |
compile | Compiles this Domain. |
adapt | Adapts this Domain according to the evidence entered. |
adaptClassTablesUsingFractionalUpdate | For each discrete node of this Domain (which must be a runtime domain) such that both the node and its source node have experience tables, the conditional probability and experience tables of both nodes are learned/updated, and the tables of the domain node will be identical to those of its source node. |
adaptClassTablesUsingOnlineEM | This function updates (adapts), for all discrete chance nodes of this Domain, the experience count (retrieval of experience) and the conditional probability distribution (dissemination of experience) for all parent configurations having a valid experience count. |
approximate | Removes “near-zero” probabilities from the clique probability tables. |
cgEvidenceIsPropagated | Check if evidence on CG nodes has been propagated. |
evidenceIsPropagated | Tests if evidence has been propagated for this Domain. |
evidenceToPropagate | Tests if evidence has been entered since the last propagation. |
retractFindings | Retracts (all) evidence for all nodes in this Domain. |
getNewModel | Constructs a Model over a Node given a list of Nodes. |
getExpectedUtility | Gets the total expected utility associated with this Domain. |
isCompiled | Tests whether this Domain is compiled. |
isTriangulated | Tests whether this Domain is triangulated. |
isTriangulatedForBK | Tests whether this Domain has been triangulated for Boyen-Koller approximate inference. |
initialize | Establishes the initial values for all tables of this Domain (which must be compiled). |
getJunctionTrees | Gets all JunctionTrees of this Domain. |
compress | Removes the zero entries from the clique and separator tables of the junction trees in this Domain. |
computeSensitivityData | Computes the constants of the sensitivity functions for the specified output probabilities and all CPT parameters in the network. |
getLogLikelihood | Computes the log-likelihood of the case data. |
getLogLikelihoodTolerance | Returns the log-likelihood tolerance for this Domain. |
getLogNormalizationConstant | Returns the log of the normalization constant. |
getMAPConfiguration | Returns a MAP configuration. |
getMarginal | Computes the marginal distribution for the Nodes provided as argument with respect to the (imaginary) joint potential, determined by the current potentials on the JunctionTrees of this Domain. |
getMaxNumberOfEMIterations | Returns the maximum number of iterations allowed for the EM algorithm. |
getMaxNumberOfSeparators | Returns the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method. |
getNormalDeviate | Use the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution. |
getNormalizationConstant | Retrieves the normalization constant for the most recent propagation. |
getNumberOfCases | Returns the number of data cases. |
getNumberOfMAPConfigurations | Returns the number of MAP configurations. |
getProbabilityOfMAPConfiguration | Returns the probability of a MAP configuration. |
getSensitivitySet | Returns the sensitivity set computed by the most recent call to Domain.computeSensitivityData. |
getSignificanceLevel | Returns the significance level of the dependency tests performed during structure learning using the PC-algorithm. |
getUniformDeviate | Use the pseudo-random number generator for this Domain to sample a real number from the uniform distribution over the interval [0,1). |
enterCase | Enters a case as evidence. |
equilibriumIs | Tests the Equilibrium type. |
isCompressed | Tests whether this Domain is compressed. |
evidenceModeIs | Tests for evidence mode. |
learnStructure | Learn the structure (graph) of the Bayesian network from data using the PC-algorithm. |
learnTables | Learns the conditional probability tables from data using the EM algorithm. |
likelihoodIsPropagated | Tests if likelihood has been propagated for this Domain |
newCase | Creates a new case. |
findMAPConfigurations | Finds all configurations of nodes with probability at least minprobability. |
getAIC | Computes the AIC score (Akaike’s Information Criterion) of the case data. |
getApproximationConstant | Returns the approximation constant. |
getBIC | Computes the BIC score (Bayesian Information Criterion) of the case data. |
getCaseCount | Returns case count for a case. |
getConflict | Returns the conflict value. |
getDConnectedNodes | Performs a d-separation test and returns a list of d-connected nodes. |
getDSeparatedNodes | Performs a d-separation test and returns a list of d-separated nodes. |
getEliminationOrder | Returns the triangulation order. |
resetInferenceEngine | Establishes the initial state of the inference engine, which is sum-equilibrium with no evidence incorporated. |
saveToMemory | Creates a copy in memory of the belief and junction tree tables of this Domain. |
seedRandom | Seeds the pseudo-random number generator for this Domain. |
setCaseCount | Sets case count for a case. |
setLogLikelihoodTolerance | Sets the log-likelihood tolerance for this Domain. |
setMaxNumberOfEMIterations | Sets the maximum number of iterations allowed for the EM algorithm. |
setMaxNumberOfSeparators | Sets the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method. |
setNumberOfCases | Sets the number of cases. |
setSignificanceLevel | Sets the significance level of the dependency tests performed during structure learning using the PC-algorithm. |
simulate | Generates a sample configuration from the joint distribution represented by this Domain. |
batchSimulate | Generates a number of sample configurations by invoking Domain.simulate a number of times and for each iteration recording the results of Node.getSampledValue, Node.getSampledState or Node.getSampledUtility for specified Nodes. |
tablesToPropagate | Tests for new node tables. |
triangulate | Triangulates the graph of this Domain using the default triangulation method. |
uncompile | Uncompiles this Domain. |
updatePolicies | Updates the policy tables of the domain. |
getExplanation | Returns the evidence subset associated with the explanation of rank index computed by the most recent call to Node.computeExplanationData. |
getExplanationScore | Returns the score of the specified explanation. |
getNumberOfExplanations | Returns the number of explanations. |
addCases | Adds the specified range of rows of the data set to this Domain as cases. |
triangulate | Triangulates the graph of this Domain using the specified triangulation method. |
computeDBNPredictions | Computes predictions for {numberOfTimePoints} time slices beyond the current time window. |
getDBNWindowOffset | Returns the total number of time steps that the time window of this DBN runtime domain has been moved. |
initializeDBNWindow | Moves the time window of this DBN back to its initial position, and removes all evidence. |
moveDBNWindow | Slides the time window of this DBN delta steps into the future. |
triangulateDBN | Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used. |
triangulateDBNForBK | Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used. |
Node | Nodes are one of the fundamental objects used in the construction of Bayesian networks and LIMIDs. |
Functions | |
getHAPI | Get the HAPI object that owns this Node |
deleteObject | Deletes this Node. |
getModel | Gets the Model for this Node. |
getName | Returns the name of this Node. |
setName | Sets the name of this Node. |
setPosition | Sets the position of this Node. |
getPositionX | Returns the position of this Node on the X-axis. |
getPositionY | Returns the position of this Node on the Y-axis. |
setNumberOfStates | Sets the number of states of this node. |
getNumberOfStates | Get the number of states of this discrete node. |
setStateLabel | Sets the label of the specified state. |
getStateLabel | Gets the label of the specified state. |
getTable | Gets the Table associated with this Node. |
getBelief | Gets the belief for the specified state of this Node. |
getParents | Get an array of parent Nodes for this Node. |
getChildren | Get an array of child Nodes for this Node. |
addParent | Adds a Node as a new parent of this Node. |
selectState | Selects the specified state of this Node. |
getSelectedState | Gets (the index of) the selected state of this node. |
retractFindings | Retracts all findings for this Node. |
getExpectedUtility | Gets the expected utility associated with this utility node or specified action of this discrete node. |
getSampledUtility | Returns the sampled utility associated with this utility node. |
getValue | Gets the value of this FunctionNode. |
setValue | Sets the function associated with this function node to a number value. |
evidenceIsEntered | Test if the evidence potential, currently registered with this Node, is non-vacuous. |
getStateIndex | Get the index of the state matching the specified value. |
getStateValue | Gets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node. |
setStateValue | Sets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node. |
enterValue | Enters evidence (observation of the value) for this continuous chance node. |
getEnteredValue | Gets the evidence (value) entered for this continuous chance node. |
evidenceIsPropagated | Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is non-vacuous; otherwise, returns false. |
evidenceToPropagate | Returns true if the entered and the propagated evidence differ; otherwise, returns false. |
getAttribute | Returns an attribute value. |
getCategory | Returns the category of this Node. |
getEdgeConstraint | Returns the constraint between this and Node. |
getHomeDomain | Returns the Domain containing this Node. |
getJunctionTree | Returns the JunctionTree to which this Node belongs. |
getKind | Returns the kind of this Node. |
getSubtype | Returns the subtype of this Node. |
getLabel | Returns the label of this Node. |
likelihoodIsPropagated | Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is a likelihood; otherwise, returns false. |
likelihoodIsEntered | Returns true if the evidence potential, currently registered with this Node, is a likelihood; otherwise, returns false. |
removeParent | Removes the directed link between a parent and this Node. |
reverseEdge | Reverses the edge between this Node and the specified neighbor. |
setAttribute | Sets a value for a particular attribute in the attribute list for this Node. |
setEdgeConstraint | Sets a constraint between this Node and another Node. |
setLabel | Sets the label of this Node. |
switchParent | Replace the given parent node with the new node. |
caseIsSet | Returns true if a value has been set for this continuous chance or discete node in case caseindex; otherwise, returns false. |
getAlpha | Returns the alpha component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i. |
getBeta | Returns the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i. |
getCaseValue | Returns the value set for this continuous chance node in case caseindex. |
getDistribution | Returns the distribution for this continuous node. |
getExperienceTable | Returns the experience table of this continuous or discrete chance node. |
getGamma | Returns the gamma component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i. |
getMean | Returns the mean of the marginal distribution of this continuous chance node. |
getPropagatedValue | Retrieves the value that has been propagated for this continuous chance Node. |
getSampledValue | Returns the value of this function or continuous chance Node for the configuration generated by the most recent call to Domain.simulate. |
getVariance | Returns the variance of the marginal distribution of this continuous chance Node. |
hasExperienceTable | Returns true if this continuous or discrete chance Node has an experience table; returns false otherwise. |
setAlpha | Sets the alpha component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i. |
setBeta | Sets the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i. |
setCaseValue | Sets the value of this continuous chance node to value in case c. |
setGamma | Sets the gamma component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i. |
unsetCase | Specifies that the value of this continuous chance or discrete node is “unknown” for case caseindex. |
computeSensitivityData | Computes the constants of the sensitivity functions for the specified output probability and all CPT/policy parameters in the network. |
getFadingTable | Returns the fading table of this discrete chance node. |
hasFadingTable | Returns true if this discrete chance Node has a fading table; returns false otherwise. |
getRequisiteAncestors | Get an array of Nodes containing the requisite ancestors of this decision Node. |
getRequisiteParents | Get an array of Nodes containing the requisite parents of this decision Node. |
enterFinding | Specifies a finding value for a given state with all other states unaffected. |
generateTable | Generates the table of this discrete Node from its Model (a missing Model will trigger an error). |
getCaseState | Returns the state of this discrete node for case c. |
getEnteredFinding | Returns the entered finding for the specified state of this node. |
getEntropy | Computes the entropy of this node. |
getMutualInformation | Computes the mutual information between this discrete Node and the specified discrete Node. |
getPropagatedFinding | Returns the propagated finding. |
getSampledState | Returns the state index of this discrete node for the configuration generated by the most recent call to Domain.simulate. |
getSensitivityConstants | Returns the four constants of the specified sensitivity function. |
getSensitivityConstantsByOutput | Returns the four constants of the specified sensitivity function. |
setCaseState | Sets the state of this discrete node to state in case c. |
getStateIndexFromLabel | Returns the index of the state matching the specified label. |
computeExplanationData | Computes Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size. |
computeExplanationData2 | Computes “normalized likelihoods” for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size. |
addToInputs | Makes this Node become an input node of its Class. |
addToOutputs | Makes this Node become an output node of its Class. |
createTemporalClone | Constructs a temporal clone of this Node. |
getHome | Returns the NetworkModel containing this Node. |
getHomeClass | Returns the Class containing this Node. |
getInstance | Returns the instance Node containing this (cloned) output node. |
getMaster | Returns the “master” of this (cloned) output Node of an instance node (i.e., the node cloned to get this output node). |
getSource | Get an array of Nodes of Class nodes that identifies this Domain node. |
getTemporalClone | Get the “temporal clone” of this Node. |
getTemporalMaster | Get the “temporal master” of this Node. |
removeFromInputs | Removes this Node from the set of input nodes of its class. |
removeFromOutputs | Removes this Node from the set of output nodes of its class. |
getPredictedBelief | Returns the predicted belief for the specified state of this discrete Node at the specified time point. |
getPredictedValue | Gets the predicted value of this FunctionNode at the specified time point. |
getPredictedMean | Returns the predicted mean of the marginal distribution of this continuous chance node at the specified time point. |
getPredictedVariance | Returns the predicted variance of the marginal distribution of this continuous chance node at the specified time point. |
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. |
Functions | |
getHAPI | Get the HAPI object that owns this Table |
deleteObject | Deletes this Table. |
getSize | Get the size of this Table. |
getNodes | Get all Nodes associated with this Table. |
getDataItem | Get the data item at position index of the discrete data of this Table. |
setDataItem | Sets a specific data item of the discrete data of this Table. |
setData | Sets a region of the discrete data of this Table. |
getData | Gets a region of the discrete data of this Table. |
getMean | Get the mean of a continuous chance Node given a configuration of the discrete chance Nodes of this Table. |
getVariance | Get the variance of a continuous chance Node given a configuration of the discrete chance Nodes of this Table. |
getCovariance | Get the covariance of a pair of continuous chance Nodes given a configuration of the discrete chance Nodes of this Table. |
computeProbabilityOfInterval | Compute the probability of a given interval for the mixture distribution represented by this Table. |
reorderNodes | Reorders the list of Nodes of this Table. |
getCGSize | Returns the CG size of this Table. |
setAllDataItems | Sets all data items of the discrete data of this Table. |
Model | A Model is a compact description of a table. |
Functions | |
getHAPI | Get the HAPI object that owns this Model |
deleteObject | Deletes this Model. |
setExpression | Associates an expression (specified as a string) with a specific configuration of the Nodes of this Model. |
getExpression | Returns the expression (as a string) associated with a specific configuration of the NodeResources of this ModelResource. |
setNumberOfSamplesPerInterval | Sets the number of values taken within each bounded interval of an interval parent when generating the conditional probability table for a node with interval parents. |
getNumberOfSamplesPerInterval | Gets the number of values per interval used when generating the conditional probability table for a node with interval parents. |
getSize | Returns the number of configurations of the Node of this Model. |
getNodes | Get all Nodes in this Model. |
Clique | Cliques represents the cliques in the junction tree. |
Functions | |
getHAPI | Get the HAPI object that owns this Clique |
getJunctionTree | Get the JunctionTree to which this Clique belongs. |
getMembers | Get the list of Nodes that are members of this Clique. |
getNeighbors | Get a list of Cliques that are neighbors of this Clique. |
JunctionTree | JunctionTrees represents the junction trees in the compiled Domain. |
Functions | |
getHAPI | Get the HAPI object that owns this JunctionTree |
cgEvidenceIsPropagated | Check if CG evidence has been propagated in this JunctionTree. |
equilibriumIs | Tests the Equilibrium type. |
evidenceIsPropagated | Tests if evidence has been propagated for this JunctionTree. |
evidenceModeIs | Tests the EvidenceMode. |
evidenceToPropagate | Tests if evidence has been entered since the last propagation. |
getCliques | Get the list of Cliques in this JunctionTree. |
getConflict | Get the conflict measure of the data inserted in this JunctionTree. |
getRoot | Get the root Clique of this JunctionTree. |
getTotalCGSize | Get the total number of CG table entries for this JunctionTree. |
getTotalSize | Get the total number of discrete table configurations for this JunctionTree. |
likelihoodIsPropagated | Tests if likelihoods have been propagated in this JunctionTree. |
tablesToPropagate | Tests if this JunctionTree contains updated tables that have not been propagated. |
propagate | Propagates evidence in this JunctionTree. |
DataSet | Instances of the DataSet represents a data set as a “matrix” with cases as rows and variables as columns. |
Functions | |
getHAPI | Get the HAPI object that owns this DataSet |
deleteObject | Deletes this DataSet. |
deleteColumn | Deletes the specified column from this DataSet. |
deleteRow | Deletes the specified row from this DataSet. |
getColumnName | Returns the name of the specified column of this DataSet. |
getDataItem | Returns the data item at the specified location of this DataSet. |
getNumberOfColumns | Returns the number of columns in this DataSet. |
getNumberOfRows | Returns the number of rows in this DataSet. |
moveColumn | Moves the specified column to a new position. |
moveRow | Moves the specified row to a new position. |
newColumn | Creates a new column in this DataSet. |
newRow | Creates a new row in this DataSet. |
setColumnName | Sets the name of the specified column of this DataSet. |
setDataItem | Sets (or deletes) the data item at the specified location of this DataSet. |
save | Submits this DataSet in the form of a CSV file to the service located at a target URL. |
download | Generate an URL for downloading this DataSet as a CSV file |
Globals | |
Constants | |
HAPI. | Represents the domain knowledge that a directed edge is forbidden from the second to the first Node in an ordered pair of Nodes. |
HAPI. | Represents the domain knowledge that a directed edge is required from the second to the first Node in an ordered pair of Nodes. |
HAPI. | Represents the domain knowledge that an edge is forbidden between a particular pair of Nodes. |
HAPI. | Represents the domain knowledge that an edge is required for a particular pair of Nodes. |
HAPI. | Represents the domain knowledge that a directed edge is forbidden from the first to the second Node in an ordered pair of Nodes. |
HAPI. | Represents the domain knowledge that a directed edge is required from the first to the second Node in an ordered pair of Nodes. |
HAPI. | Represents that no domain knowledge is available for a particular pair of Nodes. |
HAPI. | Represents the best-greedy triangulation heuristic. |
HAPI. | Represents the clique-size triangulation heuristic. |
HAPI. | Represents the clique-weight triangulation heuristic. |
HAPI. | Represents the fill-in-size triangulation heuristic. |
HAPI. | Represents the fill-in-weight triangulation heuristic. |
HAPI. | Represents the total clique-table size triangulation algorithm. |
HAPI. | Represents the normal evidence mode used for propagating evidence in this Domain. |
HAPI. | Represents the fast retraction evidence mode used for propagating evidence in this Domain. |
HAPI. | Represents max equilibrium. |
HAPI. | Represents sum equilibrium. |
HAPI. | Represents the Category tag attached to DecisionNodes. |
HAPI. | Represents the Category tag attached to FunctionNodes. |
HAPI. | Represents the Category tag attached to UtilityNodes. |
HAPI. | Represents the Category tag attached to ChanceNodes. |
HAPI. | Represents the Category tag attached to InstanceNodes. |
HAPI. | Represents the Kind tag attached to continuous nodes. |
HAPI. | Represents the Kind tag attached to discrete nodes. |
HAPI. | Represents the Kind tag attached to utility, function, and instance nodes. |
HAPI. | Represents the discrete node subtype for numbered nodes |
HAPI. | Represents the discrete node subtype for interval nodes |
HAPI. | Represents the discrete node subtype for boolean nodes |
HAPI. | Represents the discrete node subtype for labelled nodes |
HAPI. | Subtype placeholder for specifying node other than discrete. |
The HAPI class is a container for all functionality in the JavaScript for HUGIN Web Service API.
Functions | |
HAPI | Initializes a new instance of the HAPI class and binds it internally to the RESTful HUGIN Web Service API. |
getNewClassCollection | Construct an empty classcollection. |
loadClassCollection | Construct a classcollection from a HUGIN Knowledge Base retrieved over HTTP. |
loadDomain | Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL. |
loadCompileDomain | Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL. |
getNewDomain | Constructs a new empty Domain. |
loadDataSet | Instantiate a DataSet from a CSV file retrieved over HTTP. |
getNewDataSet | Construct an empty DataSet. |
refetch | Refetch cached responses from remote decision engine. |
getNewBatch | Constructs a new Batch object. |
function HAPI( webServiceHome )
Initializes a new instance of the HAPI class and binds it internally to the RESTful HUGIN Web Service API.
webServiceHome | the base uri for reaching the RESTful HUGIN Web Service API (e.g. “/webservice/hugin.php”). |
a HAPI instance that internally is bound to the HTTP interface provided by the HUGIN Web Service API.
h = new HAPI("/webservice/hugin.php");
h = new HAPI("http://myhost/webservice/hugin.php");
Important Note: Currently the JavaScript for HUGIN Web Service API require the RESTful HUGIN Web Service API and the web page executing scripts be served from the same host (hostname+port). This is due to limitations regarding cross-origin requests imposed by the browser security model
this.getNewClassCollection = function getNewClassCollection()
Construct an empty classcollection.
a ClassCollection object
cc = h.getNetClassCollection();
this.loadClassCollection = function loadClassCollection( url )
Construct a classcollection from a HUGIN Knowledge Base retrieved over HTTP.
url | The URL where the HUGIN Knowledge Base (HKB) file is to be read from |
a ClassCollection object
cc = h.loadClassCollection("http://somehost/files/cc.hkb");
this.loadDomain = function loadDomain( url )
Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL.
url | The URL where the HUGIN Knowledge Base (HKB) file is to be read from |
a Domain object
domain1 = h.loadDomain("http://somehost/files/asia.hkb"); domain2 = h.loadDomain("http://anotherhost/cars.hkb");
this.loadCompileDomain = function loadCompileDomain( url )
Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL. If the HKB file is a Domain stored in a compressed state, a sum,normal-propagation is performed, otherwise compile is invoked.
url | The URL where the HUGIN Knowledge Base (HKB) file is to be read from |
a Domain object
domain1 = h.loadCompileDomain("http://somehost/files/asia.hkb"); domain2 = h.loadCompileDomain("http://anotherhost/cars.hkb");
this.loadDataSet = function loadDataSet( url, delimiter )
Instantiate a DataSet from a CSV file retrieved over HTTP.
url | The URL where the CSV file is to be read from |
delimiter | the delimiter symbol used in the CSV file |
a DataSet object
data1 = h.loadDataSet("http://somehost/files/file1.csv", ","); data2 = h.loadDataSet("http://somehost/files/file2.csv", ",");
this.refetch = function refetch( huginObject )
Refetch cached responses from remote decision engine. This is necessary if state has been updated outside of javascript code (e.g. by an external server script).
huginObject | the root hugin object whose state is not up to date, a ClassCollection or Domain |
void
h.refetch(dom);
A Batch can be used to group together a sequence of batchable function calls and then carry out the function calls using a single HTTP request - effectively saving the round-trip-time delay of having to perform individual HTTP requests for each function. Clever use of this function could significantly speed up the web application.
In the current implementation a batchable function is a function with side-effects that returns void. As a consequence when batching multiple function calls together, if a function call produces an error we loose the ability to track exactly which specific function that failed.
When asynchronously dispatching a Batch it is the responsibility of the programmer to properly synchronize access to depending HUGIN resources until the call has returned. Exercising functions on these HUGIN resources while the batch is executing is undefined.
To acquire a Batch use the HAPI.getNewBatch function.
//procedure performed using the normal function calls //d is domain A and B and C are nodes A.selectState(0); //performs 1 HTTP post request B.selectState(2); //performs 1 HTTP post request C.selectState(2); //performs 1 HTTP post request d.propagate(HAPI.H_EQUILIBRIUM_SUM, HAPI.H_EVIDENCE_MODE_NORMAL); //performs 1 HTTP post request //total number of HTTP requests = 4 //procedure performed using batch functionality batch = hapi.getNewBatch(); //performs 0 HTTP post request batch.add(A.selectState, 0); //performs 0 HTTP post request batch.add(B.selectState, 2); //performs 0 HTTP post request batch.add(C.selectState, 2); //performs 0 HTTP post request batch.add(d.propagate, HAPI.H_EQUILIBRIUM_SUM, HAPI.H_EVIDENCE_MODE_NORMAL); //performs 0 HTTP post request batch.execute(); //performs 1 HTTP post request //total number of HTTP requests = 1
this.add = function add( command //, arg1, arg2, arg3, ..., argN )
Add a function call to the Batch queue. This is done by passing a reference to the function on a specific HUGIN object instance and supplying any arguments that the function would need when invoked normally.
command | function reference on specific HUGIN object instance. |
arg1, arg2, arg3, ..., argN | the list of arguments for command. |
void
//normal function call A.selectState(0); //append similar function call to batch b.add(A.selectState, 0);
this.execute = function execute()
Execute the queued up function calls in a synchronously blocking fashion.
If any of the batched function calls fails then Batch.execute() throws an error and further execution the batch is cancelled.
void
b.execute();
this.dispatch = function dispatch( onSuccess, onError )
Dispatch execution of queued up function calls in an asynchronously non-blocking fashion. This means that invocation of Batch.dispatch() may return immediately. When the batch has finished execution user code is notified through user supplied callback functions.
onSuccess | a callback function(), invoked if the batch is carried out with no errors. |
onError | a callback function(error), invoked if one of the batched function calls fails. |
void
//onSuccess and onError are the user callback functions function onSuccess() { //actions to perform when batch completes: retrieve beliefs from domain, update user interface or other stuff. //... } function onError(error) { //one of the function calls produced an error alert("An error occurred: " + e.name + "\n" + e.message); } //queueing up function calls and dispatching batch batch = dom.getNewBatch(); batch.add(...); //queue up a number of batchable calls batch.add(d.propagate, HAPI.H_EQUILIBRIUM_SUM, HAPI.H_EVIDENCE_MODE_NORMAL); //last function is propagate batch.dispatch(onSuccess, onError);
Classes are grouped into ClassCollections. Each class must belong to exactly one ClassCollection. A ClassCollection can be considered a closed world of interdependent Classes (i.e., Bayesian networks and LIMIDs). That is, each Class may contain instances of other Classes of the ClassCollection, but not of Classes of other ClassCollections.
A ClassCollection is instantiated using one of the HAPI classcollection functions HAPI.getNewClassCollection or HAPI.loadClassCollection.
Functions | |
getHAPI | Get the HAPI object that owns this ClassCollection |
deleteObject | Deletes this ClassCollection object, including all nested HUGIN objects belonging to it (e.g. |
getClassByName | Returns a Class by name. |
getMembers | Get all Classes of this ClassCollection. |
save | Submits this ClassCollection in the form of a HKB file to the service located at a target URL. |
download | Generate an URL for downloading this ClassCollection as a HKB file |
getNewClass | Creates a new Class. |
this.getHAPI = function getHAPI()
Get the HAPI object that owns this ClassCollection
the owning HAPI instancs.
this.deleteObject = function deleteObject()
Deletes this ClassCollection object, including all nested HUGIN objects belonging to it (e.g. Classes, Nodes, Tables etc.).
void
cc.deleteObject();
this.getMembers = function getMembers()
Get all Classes of this ClassCollection.
An array of Classes in this ClassCollection.
memberList = cc.getMembers();
this.save = function save( url, method )
Submits this ClassCollection in the form of a HKB file to the service located at a target URL.
url | the URL to submit HKB file |
method | the HTTP method to use: POST | PUT |
void
cc.save("http://somehost/someservice", "POST");
this.download = function download( filename )
Generate an URL for downloading this ClassCollection as a HKB file
filename | used for setting the Content-Disposition filename header of response. |
the URL as a string
url = cc.download("classes.hkb");
NetworkModel interface is implemented by Class and Domain. A NetworkModel cannot be instantiated explicitly; use Domain and Class.
Functions | |
getHAPI | Get the HAPI object that owns this NetworkModel |
getNodeByName | Returns a Node by name. |
getNewNode | Creates a new Node. |
getNodes | Get all Nodes in this NetworkModel. |
generateTables | Generates the conditional probability tables for all nodes of this NetworkModel. |
getAttribute | Returns an attribute value. |
parseNodes | Parses the file retrieved from an URL and returns a list of Nodes. |
setAttribute | Inserts the key/value pair in the attribute list for this NetworkModel. |
this.getHAPI = function getHAPI()
Get the HAPI object that owns this NetworkModel
the owning HAPI instancs.
ownerHapi = dom.getHAPI();
this.getNewNode = function getNewNode( category, kind, subtype )
Creates a new Node. The specifics of the node created depends on the category, kind and subtype specified.
category | the node category, see HAPI.H_CATEGORY_CHANCE, HAPI.H_CATEGORY_DECISION, HAPI.H_CATEGORY_UTILITY, HAPI.H_CATEGORY_FUNCTION. |
kind | the node kind, see HAPI.H_KIND_DISCRETE, HAPI.H_KIND_CONTINUOUS, HAPI.H_KIND_OTHER. |
subtype | the node subtype, see HAPI.H_SUBTYPE_LABEL, HAPI.H_SUBTYPE_BOOLEAN, HAPI.H_SUBTYPE_NUMBER, HAPI.H_SUBTYPE_INTERVAL, HAPI.H_SUBTYPE_OTHER. |
n = net.getNewNode(HAPI.H_CATEGORY_CHANCE, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_LABEL);
n = net.getNewNode(HAPI.H_CATEGORY_CHANCE, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_BOOLEAN);
n = net.getNewNode(HAPI.H_CATEGORY_CHANCE, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_NUMBER);
n = net.getNewNode(HAPI.H_CATEGORY_CHANCE, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_INTERVAL);
n = net.getNewNode(HAPI.H_CATEGORY_DECISION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_LABEL);
n = net.getNewNode(HAPI.H_CATEGORY_DECISION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_BOOLEAN);
n = net.getNewNode(HAPI.H_CATEGORY_DECISION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_NUMBER);
n = net.getNewNode(HAPI.H_CATEGORY_DECISION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_INTERVAL);
n = net.getNewNode(HAPI.H_CATEGORY_FUNCTION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_LABEL);
n = net.getNewNode(HAPI.H_CATEGORY_FUNCTION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_BOOLEAN);
n = net.getNewNode(HAPI.H_CATEGORY_FUNCTION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_NUMBER);
n = net.getNewNode(HAPI.H_CATEGORY_FUNCTION, HAPI.H_KIND_DISCRETE, HAPI.H_SUBTYPE_INTERVAL);
n = net.getNewNode(HAPI.H_CATEGORY_CHANCE, HAPI.H_KIND_CONTINUOUS, HAPI.H_SUBTYPE_OTHER);
n = net.getNewNode(HAPI.H_CATEGORY_UTILITY, HAPI.H_KIND_OTHER, HAPI.H_SUBTYPE_OTHER);
n = net.getNewNode(HAPI.H_CATEGORY_FUNCTION, HAPI.H_KIND_OTHER, HAPI.H_SUBTYPE_OTHER);
this.getNodes = function getNodes()
Get all Nodes in this NetworkModel.
An array of Nodes in NetworkModel.
nodes = net.getNodes();
this.generateTables = function generateTables()
Generates the conditional probability tables for all nodes of this NetworkModel. This is done by calling Node.generateTable for all nodes having a model, so the descriptions of the Node.generateTable function (for discrete and utility nodes) also apply here.
void
net.generateTables();
this.getAttribute = function getAttribute( key )
Returns an attribute value. That is, the value associated with a key in the attribute list for this NetworkModel.
key | the key for which the attribute value is returned |
a string
val = net.getAttribute("myattribute");
this.parseNodes = function parseNodes( url )
Parses the file retrieved from an URL and returns a list of Nodes. This is used for reading an elimination order from an external URL.
url | URL to the file with node names |
An array of Nodes
net.parseNodes("http://somehost/files/eliminationorder.txt");
this.setAttribute = function setAttribute( key, value )
Inserts the key/value pair in the attribute list for this NetworkModel. If the key is already defined, the value is updated. If no value is provided, the attribute is removed.
key | The key identifying the attribute to be updated. |
value | The value of the attribute. |
void
net.setAttribute("A", "abc");
Instances of Class represent object-oriented Bayesian networks and LIMIDs. Such an instance can contain nodes representing instances of other network classes and so on. To use an instance (i.e., propagate evidence and calculate updated beliefs and expected utilities), it must first be unfolded to a plain Bayesian network or LIMID. The Class.createDomain function handles this.
A Class is instantiated using ClassCollection.getNewClass.
Functions | |
deleteObject | Deletes this Class, including all Node objects belonging to it. |
createDBNDomain | Creates a DBN runtime Domain from this Class. |
createDomain | Creates a flat runtime Domain from this Class. |
getNewInstanceNode | Creates a new instance Node. |
getClassCollection | Get the ClassCollection to which this Class belongs. |
getInputs | Get all input Nodes defined for this Class. |
getInstances | Get all instance Nodes that are instances of this Class. |
getOutputs | Get all output Nodes defined for this Class. |
getName | Returns the name of this Class. |
setName | Sets the name of this Class. |
this.createDBNDomain = function createDBNDomain( numberOfSlices )
Creates a DBN runtime Domain from this Class. The domain is formed by linking (through temporal clones) the specified number of instances (called time slices) of the class.
numberOfSlices | the number of time slices; an integer. |
a Domain
dom = cls.createDBNDomain(5);
this.getClassCollection = function getClassCollection()
Get the ClassCollection to which this Class belongs.
the containing ClassCollection
cc = cls.getClassCollection();
this.setName = function setName( name )
Sets the name of this Class. The name must be valid, i.e., it must follow the rules that govern the validity of C identifiers, and no other Class in the ClassCollection must have the same name.
name | a string containing the new name of the Class |
void
cls.setName("myClass");
Instances of the Domain class represent Bayesian networks and LIMIDs in which you can propagate evidence and calculate updated beliefs and expected utilities.
A Domain is instantiated using one of the HAPI domain functions HAPI.loadDomain or HAPI.getNewDomain.
Functions | |
deleteObject | Deletes this Domain, including all Node and JunctionTree objects belonging to it. |
parseCase | Parses a case retrieved from an URL and enters the associated findings into this Domain. |
saveCase | Submits all evidence entered in this Domain to the service located at a target URL. |
save | Submits this Domain in the form of a HKB file to the service located at a target URL. |
download | Generate an URL for downloading this Domain as a HKB file |
parseCases | Parses the cases retrieved form an URL and enters the cases into this Domain. |
saveCases | Submits all cases in this Domain to the service located at a target URL. |
propagate | Establishes the specified equilibrium using the evidence mode indicated for incorporation of evidence on all JunctionTrees of this Domain. |
compile | Compiles this Domain. |
adapt | Adapts this Domain according to the evidence entered. |
adaptClassTablesUsingFractionalUpdate | For each discrete node of this Domain (which must be a runtime domain) such that both the node and its source node have experience tables, the conditional probability and experience tables of both nodes are learned/updated, and the tables of the domain node will be identical to those of its source node. |
adaptClassTablesUsingOnlineEM | This function updates (adapts), for all discrete chance nodes of this Domain, the experience count (retrieval of experience) and the conditional probability distribution (dissemination of experience) for all parent configurations having a valid experience count. |
approximate | Removes “near-zero” probabilities from the clique probability tables. |
cgEvidenceIsPropagated | Check if evidence on CG nodes has been propagated. |
evidenceIsPropagated | Tests if evidence has been propagated for this Domain. |
evidenceToPropagate | Tests if evidence has been entered since the last propagation. |
retractFindings | Retracts (all) evidence for all nodes in this Domain. |
getNewModel | Constructs a Model over a Node given a list of Nodes. |
getExpectedUtility | Gets the total expected utility associated with this Domain. |
isCompiled | Tests whether this Domain is compiled. |
isTriangulated | Tests whether this Domain is triangulated. |
isTriangulatedForBK | Tests whether this Domain has been triangulated for Boyen-Koller approximate inference. |
initialize | Establishes the initial values for all tables of this Domain (which must be compiled). |
getJunctionTrees | Gets all JunctionTrees of this Domain. |
compress | Removes the zero entries from the clique and separator tables of the junction trees in this Domain. |
computeSensitivityData | Computes the constants of the sensitivity functions for the specified output probabilities and all CPT parameters in the network. |
getLogLikelihood | Computes the log-likelihood of the case data. |
getLogLikelihoodTolerance | Returns the log-likelihood tolerance for this Domain. |
getLogNormalizationConstant | Returns the log of the normalization constant. |
getMAPConfiguration | Returns a MAP configuration. |
getMarginal | Computes the marginal distribution for the Nodes provided as argument with respect to the (imaginary) joint potential, determined by the current potentials on the JunctionTrees of this Domain. |
getMaxNumberOfEMIterations | Returns the maximum number of iterations allowed for the EM algorithm. |
getMaxNumberOfSeparators | Returns the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method. |
getNormalDeviate | Use the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution. |
getNormalizationConstant | Retrieves the normalization constant for the most recent propagation. |
getNumberOfCases | Returns the number of data cases. |
getNumberOfMAPConfigurations | Returns the number of MAP configurations. |
getProbabilityOfMAPConfiguration | Returns the probability of a MAP configuration. |
getSensitivitySet | Returns the sensitivity set computed by the most recent call to Domain.computeSensitivityData. |
getSignificanceLevel | Returns the significance level of the dependency tests performed during structure learning using the PC-algorithm. |
getUniformDeviate | Use the pseudo-random number generator for this Domain to sample a real number from the uniform distribution over the interval [0,1). |
enterCase | Enters a case as evidence. |
equilibriumIs | Tests the Equilibrium type. |
isCompressed | Tests whether this Domain is compressed. |
evidenceModeIs | Tests for evidence mode. |
learnStructure | Learn the structure (graph) of the Bayesian network from data using the PC-algorithm. |
learnTables | Learns the conditional probability tables from data using the EM algorithm. |
likelihoodIsPropagated | Tests if likelihood has been propagated for this Domain |
newCase | Creates a new case. |
findMAPConfigurations | Finds all configurations of nodes with probability at least minprobability. |
getAIC | Computes the AIC score (Akaike’s Information Criterion) of the case data. |
getApproximationConstant | Returns the approximation constant. |
getBIC | Computes the BIC score (Bayesian Information Criterion) of the case data. |
getCaseCount | Returns case count for a case. |
getConflict | Returns the conflict value. |
getDConnectedNodes | Performs a d-separation test and returns a list of d-connected nodes. |
getDSeparatedNodes | Performs a d-separation test and returns a list of d-separated nodes. |
getEliminationOrder | Returns the triangulation order. |
resetInferenceEngine | Establishes the initial state of the inference engine, which is sum-equilibrium with no evidence incorporated. |
saveToMemory | Creates a copy in memory of the belief and junction tree tables of this Domain. |
seedRandom | Seeds the pseudo-random number generator for this Domain. |
setCaseCount | Sets case count for a case. |
setLogLikelihoodTolerance | Sets the log-likelihood tolerance for this Domain. |
setMaxNumberOfEMIterations | Sets the maximum number of iterations allowed for the EM algorithm. |
setMaxNumberOfSeparators | Sets the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method. |
setNumberOfCases | Sets the number of cases. |
setSignificanceLevel | Sets the significance level of the dependency tests performed during structure learning using the PC-algorithm. |
simulate | Generates a sample configuration from the joint distribution represented by this Domain. |
batchSimulate | Generates a number of sample configurations by invoking Domain.simulate a number of times and for each iteration recording the results of Node.getSampledValue, Node.getSampledState or Node.getSampledUtility for specified Nodes. |
tablesToPropagate | Tests for new node tables. |
triangulate | Triangulates the graph of this Domain using the default triangulation method. |
uncompile | Uncompiles this Domain. |
updatePolicies | Updates the policy tables of the domain. |
getExplanation | Returns the evidence subset associated with the explanation of rank index computed by the most recent call to Node.computeExplanationData. |
getExplanationScore | Returns the score of the specified explanation. |
getNumberOfExplanations | Returns the number of explanations. |
addCases | Adds the specified range of rows of the data set to this Domain as cases. |
triangulate | Triangulates the graph of this Domain using the specified triangulation method. |
computeDBNPredictions | Computes predictions for {numberOfTimePoints} time slices beyond the current time window. |
getDBNWindowOffset | Returns the total number of time steps that the time window of this DBN runtime domain has been moved. |
initializeDBNWindow | Moves the time window of this DBN back to its initial position, and removes all evidence. |
moveDBNWindow | Slides the time window of this DBN delta steps into the future. |
triangulateDBN | Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used. |
triangulateDBNForBK | Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used. |
this.deleteObject = function deleteObject()
Deletes this Domain, including all Node and JunctionTree objects belonging to it.
void
dom.deleteObject();
this.parseCase = function parseCase( url )
Parses a case retrieved from an URL and enters the associated findings into this Domain. All existing evidence in the Domain is retracted before entering the case findings. Contents of the retrieved ressource must conform to the HUGIN case file grammar as defined in the HUGIN API manual (api-manual.pdf).
url | The URL where the HUGIN case file is to be read from |
void
dom.parseCase("http://somehost/files/casefile.hcf");
this.saveCase = function saveCase( url, method )
Submits all evidence entered in this Domain to the service located at a target URL. Submittet contents conforms to the HUGIN case file grammar as defined in the HUGIN API manual (api-manual.pdf).
url | the URL to submit case file |
method | the HTTP method to use: POST | PUT |
void
dom.saveCase("http://somehost/someservice", "POST");
this.save = function save( url, method )
Submits this Domain in the form of a HKB file to the service located at a target URL.
url | the URL to submit HKB file |
method | the HTTP method to use: POST | PUT |
void
dom.save("http://somehost/someservice", "POST");
this.download = function download( filename )
Generate an URL for downloading this Domain as a HKB file
filename | used for setting the Content-Disposition filename header of response. |
the URL as a string
url = dom.download("network.hkb");
this.parseCases = function parseCases( url )
Parses the cases retrieved form an URL and enters the cases into this Domain. Contents of the retrieved ressource must conform to the HUGIN data file grammar as defined in the HUGIN API manual (api-manual.pdf).
url | The URL where the HUGIN data file is to be read from |
void
dom.parseCases("http://somehost/files/cases.dat");
this.saveCases = function saveCases( url, method, nodes, cases, caseCounts, separator, missingData )
Submits all cases in this Domain to the service located at a target URL. Submittet contents uses specified separator between data items and missingData for missing data; and otherwise conforms to the HUGIN data file grammar as defined in the HUGIN API manual (api-manual.pdf)
url | the URL to submit case file |
method | the HTTP method to use: POST | PUT |
nodes | a list of all nodes which are to be included in the file; an array of Nodes. |
cases | an array of integers specifying the case indexes of cases to be included in the file. Note: passing null or an empty array for this parameter will include all cases. |
caseCounts | boolean value. 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 |
void
nodes = dom.getNodes(); dom.saveCase("http://somehost/someservice", "POST", nodes, null, false, ",", "");
this.propagate = function propagate( equilibrium, 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.
equilibrium | Equilibrium type. The normal Equilibrium type is HAPI.H_EQUILIBRIUM_SUM. |
evidenceMode | EvidenceMode type. The normal EvidenceMode type is HAPI.H_EVIDENCE_MODE_NORMAL. |
void
dom.propagate(HAPI.H_EQUILIBRIUM_SUM, HAPI.H_EVIDENCE_MODE_NORMAL);
this.compile = function compile()
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).
void
dom.compile();
this.adapt = function adapt()
Adapts this Domain according to the evidence entered.
void
dom.adapt();
this.adaptClassTablesUsingFractionalUpdate = function adaptClassTablesUsingFractionalUpdate()
For each discrete node of this Domain (which must be a runtime domain) such that both the node and its source node have experience tables, the conditional probability and experience tables of both nodes are learned/updated, and the tables of the domain node will be identical to those of its source node.
Nodes (in this domain or in the object-oriented model) without experience tables will not be modified.
This function updates (adapts), for all discrete nodes.
void
dom.adaptClassTablesUsingFractionalUpdate();
this.adaptClassTablesUsingOnlineEM = function adaptClassTablesUsingOnlineEM()
This function updates (adapts), for all discrete chance nodes of this Domain, the experience count (retrieval of experience) and the conditional probability distribution (dissemination of experience) for all parent configurations having a valid experience count. (Fading factors are ignored.)
The alpha argument and the total experience determine the learning rate of the update step.
alpha | the parameter to be used for online EM (a real number). |
void
dom.adaptClassTablesUsingOnlineEM(0.5);
this.approximate = function approximate( epsilon )
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.
epsilon | the threshold value. Maximal probability mass to eradicate from each clique. |
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 - epsilon, as the epsilon value is relative to each clique. Typically, the amount of probability mass removed will be somewhat larger than epsilon.
remainProbMass = dom.approximate(0.01);
this.cgEvidenceIsPropagated = function cgEvidenceIsPropagated()
Check if evidence on CG nodes has been propagated.
Returns true if evidence on CG nodes has been propagated; otherwise, returns false.
cgIsPropagated = dom.cgEvidenceIsPropagated();
this.evidenceIsPropagated = function evidenceIsPropagated()
Tests if evidence has been propagated for this Domain.
Returns true if evidence has been propagated; otherwise, returns false.
evidenceIsPropagated = dom.evidenceIsPropagated();
this.evidenceToPropagate = function evidenceToPropagate()
Tests if evidence has been entered since the last propagation.
Returns true if evidence has been entered since the last propagation; otherwise, returns false.
result = dom.evidenceToPropagate();
this.retractFindings = function retractFindings()
Retracts (all) evidence for all nodes in this Domain.
Notice: Only possible for discrete and continuous nodes.
void
dom.retractFindings();
this.getNewModel = function getNewModel( belongsTo, modelNodes )
Constructs a Model over a Node given a list of Nodes.
belongsTo | the Node that the new Model belongs to. |
modelNodes | a list of any model nodes for the new Model; an array of Nodes. |
modelNodes = [c, d]; model = dom.getNewModel(b, modelNodes);
this.getExpectedUtility = function getExpectedUtility()
Gets the total expected utility associated with this Domain.
Notice: Only possible for utility and discrete nodes.
A real number representing the expected utility.
util = dom.getExpectedUtility();
this.isTriangulated = function isTriangulated()
Tests whether this Domain is triangulated. Being “triangulated” means that the junction forest has been created, but not the associated tables.
Returns true if Domain is triangulated; otherwise, returns false.
triangulated = dom.isTriangulated();
this.isTriangulatedForBK = function isTriangulatedForBK()
Tests whether this Domain has been triangulated for Boyen-Koller approximate inference. That is, has this Domain been triangulated using Domain.triangulateDBNForBK.
Returns true if Domain is triangulated for Boyen-Koller; otherwise, returns false.
triangulated = dom.isTriangulatedForBK();
this.initialize = function initialize()
Establishes the initial values for all tables of this Domain (which must be compiled). This method erases all evidence previously entered.
void
dom.initialize();
this.getJunctionTrees = function getJunctionTrees()
Gets all JunctionTrees of this Domain.
An array of JunctionTrees in this Domain.
trees = dom.getJunctionTrees();
this.compress = function compress()
Removes the zero entries from the clique and separator tables of the junction trees 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.
void
dom.compress();
this.computeSensitivityData = function computeSensitivityData( nodes, states )
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 nodes and a list of corresponding states.
nodes | the list of (output) nodes; an array of Nodes. |
states | a list of states of the nodes in the nodes list; an array of state indices (integers). |
void
nodes = [A, B]; states = [0, 2]; dom.computeSensitivityData(nodes, states);
this.getLogLikelihoodTolerance = function getLogLikelihoodTolerance()
Returns the log-likelihood tolerance for this Domain.
A real number representing the log-likelihood tolerance.
llt = dom.getLogLikelihoodTolerance();
this.getLogNormalizationConstant = function getLogNormalizationConstant()
Returns the log of the normalization constant.
A real number representing the log of the normalization constant.
lnc = dom.getLogNormalizationConstant();
this.getMAPConfiguration = function getMAPConfiguration( index )
Returns a MAP configuration. This method returns the configuration identified by index among the configurations with probability at least minProbability - as specified in the most recent successful call to Domain.findMAPConfigurations.
The index argument must be a nonnegative integer less than Domain.getNumberOfMAPConfigurations: 0 requests the most probable configuration, 1 the second-most probable configuration, etc.
index | identifies the configuration; an integer. |
an array of state indexes forming the configuration of the Nodes passed to Domain.findMAPConfigurations.
configuration = dom.getMAPConfiguration(0);
this.getMarginal = function getMarginal( 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 JunctionTrees of this Domain. If nodes contains continuous nodes, they must be last in the list. This operation is not allowed on compressed domains.
nodes | list of Nodes over which to compute the marginal; an array of Nodes. |
A Table containing the marginal distribution over the Nodes in nodes.
nodes = [A, B, C]; tbl = domain.getMarginal(nodes);
this.getMaxNumberOfEMIterations = function getMaxNumberOfEMIterations()
Returns the maximum number of iterations allowed for the EM algorithm.
the maximum number of iterations allowed for the EM algorithm; an integer.
maxiter = dom.getMaxNumberOfEMIterations();
this.getMaxNumberOfSeparators = function getMaxNumberOfSeparators()
Returns the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method.
the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method; an integer.
maxsep = dom.getMaxNumberOfSeparators();
this.getNormalDeviate = function getNormalDeviate( mean, variance )
Use the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution.
mean | the mean of the distribution; a real number. |
variance | the variance of the distribution ; a real number. |
real number
nd = domain.getNormalDeviate(1, 2);
this.getNormalizationConstant = function getNormalizationConstant()
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.
real number
nc = dom.getNormalizationConstant();
this.getNumberOfCases = function getNumberOfCases()
Returns the number of data cases.
an integer; the number of data cases.
numcases = dom.getNumberOfCases();
this.getNumberOfMAPConfigurations = function getNumberOfMAPConfigurations()
Returns the number of MAP configurations. This method returns the number of configurations found by the most recent successful call to Domain.findMAPConfigurations.
an integer.
numconf = dom.getNumberOfMAPConfigurations();
this.getProbabilityOfMAPConfiguration = function getProbabilityOfMAPConfiguration( index )
Returns the probability of a MAP configuration. This method returns the probability of the configuration returned by Domain.getMAPConfiguration
index | identifies the configuration; an integer. |
a real number.
prob = dom.getProbabilityOfMAPConfiguration(1);
this.getSensitivitySet = function getSensitivitySet()
Returns the sensitivity set computed by the most recent call to Domain.computeSensitivityData. If the results produced by that call have been invalidated, an error is thrown.
An array of Nodes.
nodes = dom.getSensitivitySet();
this.getSignificanceLevel = function getSignificanceLevel()
Returns the significance level of the dependency tests performed during structure learning using the PC-algorithm. The default value is 0.05.
a real number.
siglevel = dom.getSignificanceLevel();
this.getUniformDeviate = function getUniformDeviate()
Use the pseudo-random number generator for this Domain to sample a real number from the uniform distribution over the interval [0,1).
a real number.
unidev = dom.getUniformDeviate();
this.enterCase = function enterCase( index )
Enters a case as evidence.
index | case index; an integer. |
void
dom.enterCase(10);
this.equilibriumIs = function equilibriumIs( equilibrium )
Tests the Equilibrium type. Returns true if the equilibrium states of all JunctionTrees of this Domain are identical to equilibrium; otherwise, returns false.
equilibrium | the type of Equilibrium to test for. The normal Equilibrium type is HAPI.H_EQUILIBRIUM_SUM. |
a boolean. Returns true if the equilibrium states of all JunctionTrees of this Domain are identical to equilibrium; otherwise, returns false.
result = dom.equilibriumIs(HAPI.H_EQUILIBRIUM_SUM);
this.evidenceModeIs = function evidenceModeIs( mode )
Tests for evidence mode. Returns true if the equilibrium states of all JunctionTrees of this Domain could have been obtained through a propagation using mode as the evidence incorporation mode. Otherwise, returns false.
mode | the type of EvidenceMode to test for. The normal EvidenceMode type is HAPI.H_EVIDENCE_MODE_NORMAL. |
a boolean. Returns true if the equilibrium states of all JunctionTrees of this Domain could have been obtained through a propagation using mode as the evidence incorporation mode. Otherwise, returns false.
result = dom.evidenceModeIs(HAPI.H_EVIDENCE_MODE_NORMAL);
this.learnStructure = function learnStructure()
Learn the structure (graph) of the Bayesian network from data using the PC-algorithm.
void
dom.learnStructure();
this.learnTables = function learnTables()
Learns the conditional probability tables from data using the EM algorithm.
void
dom.learnTables();
this.likelihoodIsPropagated = function likelihoodIsPropagated()
Tests if likelihood has been propagated for this Domain
a boolean. Returns true if likelihood has been propagated for this Domain; otherwise, returns false.
likelihoodIsPropagated = dom.likelihoodIsPropagated();
this.newCase = function newCase()
Creates a new case.
an integer; the case index for the newly created case.
caseindex = dom.newCase();
this.findMAPConfigurations = function findMAPConfigurations( nodes, minprobability )
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 and Domain.getProbabilityOfMAPConfiguration.
nodes | list of discrete Nodes for which to find configurations; an array of Nodes. |
minprobability | configurations with a lower probability than minprobability are ignored; a real number. |
void
nodes = [A, B, C]; domain.findMAPConfigurations(nodes, 0.5);
this.getAIC = function getAIC()
Computes the AIC score (Akaike’s Information Criterion) of the case data.
a real number.
score = dom.getAIC();
this.getApproximationConstant = function getApproximationConstant()
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 acompressed 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 Domain.getApproximationConstant.
a real number.
approx = dom.getApproximationConstant();
this.getBIC = function getBIC()
Computes the BIC score (Bayesian Information Criterion) of the case data.
a real number.
score = dom.getBIC();
this.getCaseCount = function getCaseCount( caseindex )
Returns case count for a case.
caseindex | the case for which to get the count. |
a real number. The multiplicity of case caseindex.
count = dom.getCaseCount(10);
this.getConflict = function getConflict()
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.
a real number.
conf = dom.getConflict();
this.getDConnectedNodes = function getDConnectedNodes( source, hard, soft )
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.
source | list of source nodes; an array of Nodes. |
hard | list of nodes assumed to be instantiated; an array of Nodes. |
soft | list of nodes assumed to have multi-state or likelihood evidence; an array of Nodes. |
An array of Nodes.
source = [ ... ]; hard = [ ... ]; soft = [ ... ]; nodes = dom.getDConnectedNodes(source, hard, soft);
this.getDSeparatedNodes = function getDSeparatedNodes( source, hard, soft )
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.
source | list of source nodes; an array of Nodes. |
hard | list of nodes assumed to be instantiated; an array of Nodes. |
soft | list of nodes assumed to have multi-state or likelihood evidence; an array of Nodes. |
An array of Nodes.
source = [ ... ]; hard = [ ... ]; soft = [ ... ]; nodes = dom.getDSeparatedNodes(source, hard, soft);
this.getEliminationOrder = function getEliminationOrder()
Returns the triangulation order. A list of Nodes in the order used to triangulate the network of this Domain is returned.
An array of Nodes.
elim = dom.getEliminationOrder();
this.resetInferenceEngine = function resetInferenceEngine()
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 junction tree potentials, but entered evidence will still be “registered” (i.e., they will be incorporated in the next propagation).
void
dom.resetInferenceEngine();
this.saveToMemory = function saveToMemory()
Creates a copy in memory of the belief and junction tree tables of this Domain. This operation can only be performed if the domain is compiled, the current equilibrium equals HAPI.H_EQUILIBRIUM_SUM, and no evidence has been incorporated.
void
dom.saveToMemory();
this.seedRandom = function seedRandom( seed )
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.
seed | the seed; an integer. |
void
dom.seedRandom(1000);
this.setCaseCount = function setCaseCount( caseindex, count )
Sets case count for a case.
caseindex | case index; an integer. |
count | the count; a real number. |
void
dom.setCaseCount(10, 2.5);
this.setMaxNumberOfEMIterations = function setMaxNumberOfEMIterations( maxnumber )
Sets the maximum number of iterations allowed for the EM algorithm. A value of 0 specifies an unbounded number of iterations.
maxnumber | an integer. |
void
dom.setMaxNumberOfEMIterations(10);
this.setMaxNumberOfSeparators = function setMaxNumberOfSeparators( maxnumber )
Sets the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method. A value of 0 specifies an unbounded number of separators.
maxnumber | an integer. |
void
dom.setMaxNumberOfSeparators(0);
this.setNumberOfCases = function setNumberOfCases( size )
Sets the number of cases.
size | an integer. |
void
dom.setNumberOfCases(100);
this.setSignificanceLevel = function setSignificanceLevel( alpha )
Sets the significance level of the dependency tests performed during structure learning using the PC-algorithm. The default value is 0.05.
alpha | an integer. |
void
dom.setSignificanceLevel(0.1);
this.simulate = function simulate()
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 junction tree(s). This distribution must be in sum-equilibrium with evidence incorporated in normal mode.
void
dom.simulate();
this.batchSimulate = function batchSimulate( iterations, nodes )
Generates a number of sample configurations by invoking Domain.simulate a number of times and for each iteration recording the results of Node.getSampledValue, Node.getSampledState or Node.getSampledUtility for specified Nodes.
iterations | the number of times to invoke Domain.simulate and record results. |
nodes | list of nodes to record the result of Node.getSampledValue, Node.getSampledState or Node.getSampledUtility for each Domain.simulate iteration. |
{ node: [....], ... } | an associative array of nodes and simulated values. Results are indexed on a [NODE][iteration] basis. |
A = dom.getNodeByName("A"); B = dom.getNodeByName("B"); result = dom.batchSimulate(10, [A, B]); //display the Node.getSampledValue(), Node.getSampledState() or Node.getSampledUtility() result //for node A from the fifth simulation iteration alert(result[A][4]);
this.tablesToPropagate = function tablesToPropagate()
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.
a boolean
result = dom.tablesToPropagate();
this.uncompile = function uncompile()
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 produce an error). 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.
void
dom.uncompile();
this.updatePolicies = function updatePolicies()
Updates the policy tables of the domain. The policies of all unmade decisions are updated. The new policies maximize the overall expected utility.
void
dom.updatePolicies();
this.getExplanation = function getExplanation( index )
Returns the evidence subset associated with the explanation of rank index computed by the most recent call to Node.computeExplanationData.
index | specifies that the indexth best explanation should be retrieved (the best explanation has index 0, the second best has index 1, etc.) |
An array of Nodes.
this.getExplanationScore = function getExplanationScore( index )
Returns the score of the specified explanation. This function returns the score associated with the explanation subset returned by Domain.getExplanation.
index | identifies the explanation. |
A real number.
this.getNumberOfExplanations = function getNumberOfExplanations()
Returns the number of explanations. This function returns the number of subsets found by the most recent successful call to Node.computeExplanationData.
Number of explanations.
this.computeDBNPredictions = function computeDBNPredictions()
Computes predictions for {numberOfTimePoints} time slices beyond the current time window. This Domain must have been produced by Class.createDBNDomain, and it must have been triangulated using Domain.triangulateDBN. The predictions are accessed using Node.getPredictedBelief.
numberOfTimePoints | the number of time slices to compute predictions for (this must be a positive number); an integer. |
void
this.initializeDBNWindow = function initializeDBNWindow()
Moves the time window of this DBN back to its initial position, and removes all evidence. This Domain must have been produced by Class.createDBNDomain, and it must have been triangulated using Domain.triangulateDBN.
void
this.moveDBNWindow = function moveDBNWindow()
Slides the time window of this DBN delta steps into the future. This Domain must have been produced by Class.createDBNDomain, and it must have been triangulated using Domain.triangulateDBN.
delta | the number of time steps to slide the time window (this must be a positive number); an integer. |
void
this.triangulateDBN = function triangulateDBN( tm )
Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used.
tm | the triangulation method to use. |
void
this.triangulateDBNForBK = function triangulateDBNForBK( tm )
Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used. Boyen-Koller approximations between time slices within the window are applied.
tm | the triangulation method to use. |
void
Nodes are one of the fundamental objects used in the construction of Bayesian networks and LIMIDs. All nodes need a Domain; that is, the network must exist before its nodes can be created.
A Node can be created using the Domain node function <Domain.getNewNode>.
Functions | |
getHAPI | Get the HAPI object that owns this Node |
deleteObject | Deletes this Node. |
getModel | Gets the Model for this Node. |
getName | Returns the name of this Node. |
setName | Sets the name of this Node. |
setPosition | Sets the position of this Node. |
getPositionX | Returns the position of this Node on the X-axis. |
getPositionY | Returns the position of this Node on the Y-axis. |
setNumberOfStates | Sets the number of states of this node. |
getNumberOfStates | Get the number of states of this discrete node. |
setStateLabel | Sets the label of the specified state. |
getStateLabel | Gets the label of the specified state. |
getTable | Gets the Table associated with this Node. |
getBelief | Gets the belief for the specified state of this Node. |
getParents | Get an array of parent Nodes for this Node. |
getChildren | Get an array of child Nodes for this Node. |
addParent | Adds a Node as a new parent of this Node. |
selectState | Selects the specified state of this Node. |
getSelectedState | Gets (the index of) the selected state of this node. |
retractFindings | Retracts all findings for this Node. |
getExpectedUtility | Gets the expected utility associated with this utility node or specified action of this discrete node. |
getSampledUtility | Returns the sampled utility associated with this utility node. |
getValue | Gets the value of this FunctionNode. |
setValue | Sets the function associated with this function node to a number value. |
evidenceIsEntered | Test if the evidence potential, currently registered with this Node, is non-vacuous. |
getStateIndex | Get the index of the state matching the specified value. |
getStateValue | Gets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node. |
setStateValue | Sets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node. |
enterValue | Enters evidence (observation of the value) for this continuous chance node. |
getEnteredValue | Gets the evidence (value) entered for this continuous chance node. |
evidenceIsPropagated | Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is non-vacuous; otherwise, returns false. |
evidenceToPropagate | Returns true if the entered and the propagated evidence differ; otherwise, returns false. |
getAttribute | Returns an attribute value. |
getCategory | Returns the category of this Node. |
getEdgeConstraint | Returns the constraint between this and Node. |
getHomeDomain | Returns the Domain containing this Node. |
getJunctionTree | Returns the JunctionTree to which this Node belongs. |
getKind | Returns the kind of this Node. |
getSubtype | Returns the subtype of this Node. |
getLabel | Returns the label of this Node. |
likelihoodIsPropagated | Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is a likelihood; otherwise, returns false. |
likelihoodIsEntered | Returns true if the evidence potential, currently registered with this Node, is a likelihood; otherwise, returns false. |
removeParent | Removes the directed link between a parent and this Node. |
reverseEdge | Reverses the edge between this Node and the specified neighbor. |
setAttribute | Sets a value for a particular attribute in the attribute list for this Node. |
setEdgeConstraint | Sets a constraint between this Node and another Node. |
setLabel | Sets the label of this Node. |
switchParent | Replace the given parent node with the new node. |
caseIsSet | Returns true if a value has been set for this continuous chance or discete node in case caseindex; otherwise, returns false. |
getAlpha | Returns the alpha component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i. |
getBeta | Returns the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i. |
getCaseValue | Returns the value set for this continuous chance node in case caseindex. |
getDistribution | Returns the distribution for this continuous node. |
getExperienceTable | Returns the experience table of this continuous or discrete chance node. |
getGamma | Returns the gamma component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i. |
getMean | Returns the mean of the marginal distribution of this continuous chance node. |
getPropagatedValue | Retrieves the value that has been propagated for this continuous chance Node. |
getSampledValue | Returns the value of this function or continuous chance Node for the configuration generated by the most recent call to Domain.simulate. |
getVariance | Returns the variance of the marginal distribution of this continuous chance Node. |
hasExperienceTable | Returns true if this continuous or discrete chance Node has an experience table; returns false otherwise. |
setAlpha | Sets the alpha component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i. |
setBeta | Sets the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i. |
setCaseValue | Sets the value of this continuous chance node to value in case c. |
setGamma | Sets the gamma component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i. |
unsetCase | Specifies that the value of this continuous chance or discrete node is “unknown” for case caseindex. |
computeSensitivityData | Computes the constants of the sensitivity functions for the specified output probability and all CPT/policy parameters in the network. |
getFadingTable | Returns the fading table of this discrete chance node. |
hasFadingTable | Returns true if this discrete chance Node has a fading table; returns false otherwise. |
getRequisiteAncestors | Get an array of Nodes containing the requisite ancestors of this decision Node. |
getRequisiteParents | Get an array of Nodes containing the requisite parents of this decision Node. |
enterFinding | Specifies a finding value for a given state with all other states unaffected. |
generateTable | Generates the table of this discrete Node from its Model (a missing Model will trigger an error). |
getCaseState | Returns the state of this discrete node for case c. |
getEnteredFinding | Returns the entered finding for the specified state of this node. |
getEntropy | Computes the entropy of this node. |
getMutualInformation | Computes the mutual information between this discrete Node and the specified discrete Node. |
getPropagatedFinding | Returns the propagated finding. |
getSampledState | Returns the state index of this discrete node for the configuration generated by the most recent call to Domain.simulate. |
getSensitivityConstants | Returns the four constants of the specified sensitivity function. |
getSensitivityConstantsByOutput | Returns the four constants of the specified sensitivity function. |
setCaseState | Sets the state of this discrete node to state in case c. |
getStateIndexFromLabel | Returns the index of the state matching the specified label. |
computeExplanationData | Computes Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size. |
computeExplanationData2 | Computes “normalized likelihoods” for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size. |
addToInputs | Makes this Node become an input node of its Class. |
addToOutputs | Makes this Node become an output node of its Class. |
createTemporalClone | Constructs a temporal clone of this Node. |
getHome | Returns the NetworkModel containing this Node. |
getHomeClass | Returns the Class containing this Node. |
getInstance | Returns the instance Node containing this (cloned) output node. |
getMaster | Returns the “master” of this (cloned) output Node of an instance node (i.e., the node cloned to get this output node). |
getSource | Get an array of Nodes of Class nodes that identifies this Domain node. |
getTemporalClone | Get the “temporal clone” of this Node. |
getTemporalMaster | Get the “temporal master” of this Node. |
removeFromInputs | Removes this Node from the set of input nodes of its class. |
removeFromOutputs | Removes this Node from the set of output nodes of its class. |
getPredictedBelief | Returns the predicted belief for the specified state of this discrete Node at the specified time point. |
getPredictedValue | Gets the predicted value of this FunctionNode at the specified time point. |
getPredictedMean | Returns the predicted mean of the marginal distribution of this continuous chance node at the specified time point. |
getPredictedVariance | Returns the predicted variance of the marginal distribution of this continuous chance node at the specified time point. |
this.deleteObject = function deleteObject()
Deletes this Node.
void
n.deleteObject();
this.setName = function setName( name )
Sets the name of this Node. The name must be valid, i.e., it must follow the rules that govern the validity of C identifiers, and no other Node in the Domain to which this Node belongs must have the same name.
name | a string containing the new name of the Node |
void
n.setName("myNode");
this.setPosition = function setPosition( X, Y )
Sets the position of this Node.
X | the position on the X-axis (an integer) |
Y | the position on the Y-axis (an integer) |
void
n.setPosition(10,20);
this.getNumberOfStates = function getNumberOfStates()
Get the number of states of this discrete node. The states are numbered from 0 to N-1, where N is the number of states of the node. Notice: Only possible for discrete nodes.
number of states of this discrete node.
stateCount = n.getNumberOfStates();
this.setStateLabel = function setStateLabel( state, newLabel )
Sets the label of the specified state. Notice: Only possible for discrete nodes.
state | the index (a nonnegative integer) of the state; must be less than the number of states of the node. |
newLabel | the desired state label. |
void
n.setStateLabel(0, "State 0"); n.setStateLabel(1, "State 1");
this.getStateLabel = function getStateLabel( state )
Gets the label of the specified state. Notice: Only possible for discrete nodes.
state | the index (a nonnegative integer) of the state; must be less than the number of states of the node. |
Returns a string containing the label of the specified state.
label0 = n.getStateLabel(0); label1 = n.getStateLabel(1);
this.getTable = function getTable()
Gets the Table associated with this Node. If the node is a discrete chance node, the table is the conditional probability table for the node given its parents. If the node is a utility node, the table represents a utility function of the parents of the node.
Returns the Table associated with this Node.
tbl = n.getTable();
this.getBelief = function getBelief( state )
Gets the belief for the specified state of this Node. Note that if findings have been entered since the most recent propagation, the beliefs returned may not be up-to-date. Notice: Only possible for discrete nodes.
state | an integer value representing which state to examine. |
A real number representing the belief.
beliefState0 = n.getBelief(0); beliefState1 = n.getBelief(1);
this.selectState = function selectState( state )
Selects the specified state of this Node. This is equivalent to specifying the finding value 1 for the specified state and 0 for all other states. Notice: Only possible for discrete nodes.
state | an integer value representing which state to select. |
void
n.selectState(2);
this.getSelectedState = function getSelectedState()
Gets (the index of) the selected state of this node. If no state is selected, a negative index is returned. Notice: Only possible for discrete nodes.
the index of the selected state of this node. If no state is selected, a negative index is returned.
selectedState = n.getSelectedState();
this.retractFindings = function retractFindings()
Retracts all findings for this Node. For discrete nodes this is equivalent to setting the finding value to 1 for all states of this node.
void
n.retractFindings();
this.getExpectedUtility = function getExpectedUtility( state )
Gets the expected utility associated with this utility node or specified action of this discrete node. This is the utility value computed by the most recent inference operation. Notice: Only possible for utility and discrete nodes.
state | an integer value designating which state of the discrete node to examine. Notice: for utility nodes leave out the parameter or specify a value of -1. |
A real number; the utility for the requested state of this discrete node, or the utility associated with this utility node.
utilU = u.getExpectedUtility(); utilN = n.getExpectedUtility(0);
this.getSampledUtility = function getSampledUtility()
Returns the sampled utility associated with this utility node. This is the utility value sampled by the most recent call to DomainResource -> /simulate. Notice: Only possible for utility nodes.
A real number; the sampled utility.
utilU = u.getSampledUtility();
this.getValue = function getValue()
Gets the value of this FunctionNode. The value is computed using the function associated with the node. If the function refers to other nodes, then the values of those nodes are derived from the results of the most recent inference operation. Notice: Only possible for function nodes.
A real number.
val = n.getValue();
this.setValue = function setValue( value )
Sets the function associated with this function node to a number value. This is equivalent to retrieving the model and modifying the expression manually. Notice: Only possible for function nodes that have no model nodes. Furthermore the domain MUST be in a compiled state and an equilibrium, and tables MUST be up to date.
value | a real number representing a fixed value function to use as the new function for this function node. |
void
n.setValue(1.5);
this.evidenceIsEntered = function evidenceIsEntered()
Test if the evidence potential, currently registered with this Node, is non-vacuous.
Returns true if the evidence potential, currently registered with this Node, is non-vacuous; otherwise, returns false.
hasEvidence = n.evidenceIsEntered();
this.getStateIndex = function getStateIndex( value )
Get the index of the state matching the specified value. If there is no (unique) state with the specified state value, -1 is returned. Notice: Only possible for numbered and interval discrete nodes.
value | a state containing this value will be searched for. |
The index of the state with the specified state value.
state = n.getStateIndex(2.5);
this.getStateValue = function getStateValue( state )
Gets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node. For interval nodes, to indicate the right endpoint of the rightmost interval, specify state equal to the number of states of this interval node. Notice: Only possible for numbered and interval discrete nodes.
state | index of the state. |
The value associated with a particular state of this numbered node or the low value of the interval
val = n.getStateValue(1);
this.setStateValue = function setStateValue( state, value )
Sets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node. For interval nodes, to indicate the right endpoint of the rightmost interval, specify state equal to the number of states of this interval node. Notice: Only possible for numbered and interval discrete nodes.
state | index of the state. |
value | the value to set (a real number). |
void
n.setStateValue(1, 10);
this.enterValue = function enterValue( value )
Enters evidence (observation of the value) for this continuous chance node. Notice: Only possible for continuous nodes.
value | a real number representing the observation. |
void
n.enterValue(1.5);
this.getEnteredValue = function getEnteredValue()
Gets the evidence (value) entered for this continuous chance node. If no value has been entered, an error is thrown. Notice: Only possible for continuous nodes.
A real number expressing the value entered.
val = n.getEnteredValue();
this.evidenceIsPropagated = function evidenceIsPropagated()
Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is non-vacuous; otherwise, returns false.
Returns true if evidence has been propagated for this Node; otherwise, returns false.
evidenceIsPropagated = N.evidenceIsPropagated();
this.evidenceToPropagate = function evidenceToPropagate()
Returns true if the entered and the propagated evidence differ; otherwise, returns false.
Returns true if evidence has been entered since the last propagation; otherwise, returns false.
result = N.evidenceToPropagate();
this.getAttribute = function getAttribute( key )
Returns an attribute value. That is, the value associated with a key in the attribute list for this Node.
key | the key for which the attribute value is returned Returns: a string |
val = N.getAttribute("myattribute");
this.getCategory = function getCategory()
Returns the category of this Node.
the node category, the string equals either HAPI.H_CATEGORY_CHANCE, HAPI.H_CATEGORY_DECISION, HAPI.H_CATEGORY_UTILITY, HAPI.H_CATEGORY_FUNCTION or HAPI.H_CATEGORY_INSTANCE.
category = N.getCategory();
this.getEdgeConstraint = function getEdgeConstraint( node )
Returns the constraint between this and Node.
node | a Node. |
The constraint between this and Node, the string equals either HAPI.H_CONSTRAINT_BACKWARD_EDGE_FORBIDDEN, HAPI.H_CONSTRAINT_BACKWARD_EDGE_REQUIRED, HAPI.H_CONSTRAINT_EDGE_FORBIDDEN, HAPI.H_CONSTRAINT_EDGE_REQUIRED, HAPI.H_CONSTRAINT_FORWARD_EDGE_FORBIDDEN, HAPI.H_CONSTRAINT_FORWARD_EDGE_REQUIRED or HAPI.H_CONSTRAINT_NONE
constraint = A.getEdgeConstraint(B);
this.getJunctionTree = function getJunctionTree()
Returns the JunctionTree to which this Node belongs.
a JunctionTree.
jt = N.getJunctionTree();
this.getKind = function getKind()
Returns the kind of this Node.
the node kind, the string equals either HAPI.H_KIND_CONTINUOUS, HAPI.H_KIND_DISCRETE or HAPI.H_KIND_OTHER.
kind = N.getKind();
this.getSubtype = function getSubtype()
Returns the subtype of this Node.
the node subtype, the string equals either HAPI.H_SUBTYPE_NUMBER, HAPI.H_SUBTYPE_INTERVAL, HAPI.H_SUBTYPE_BOOLEAN, HAPI.H_SUBTYPE_LABEL or HAPI.H_SUBTYPE_OTHER.
subtype = N.getSubtype();
this.likelihoodIsPropagated = function likelihoodIsPropagated()
Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is a likelihood; otherwise, returns false.
a boolean
likelihoodIsPropagated = N.likelihoodIsPropagated();
this.removeParent = function removeParent( node )
Removes the directed link between a parent and this Node. The table (if any) of the Node will be updated such that the updated table will be the portion of the old table that corresponds to the parent being in its first state.
node | a Node |
void
C.removeParent(N);
this.reverseEdge = function reverseEdge( node )
Reverses the edge between this Node and the specified neighbor. Both nodes must be chance nodes, and they must be of the same kind (that is, both nodes are discrete or both nodes are continuous).
node | a neighboring Node |
void
A.reverseEdge(B);
this.setAttribute = function setAttribute( key, value )
Sets a value for a particular attribute in the attribute list for this Node. If no value is provided, the attribute is removed.
key | The key identifying the attribute to be updated. |
value | The value of the attribute. |
void
N.setAttribute("A", "abc");
this.setEdgeConstraint = function setEdgeConstraint( node, constraint )
Sets a constraint between this Node and another Node.
node | a Node |
constraint | the node constraint. Must be one of either HAPI.H_CONSTRAINT_BACKWARD_EDGE_FORBIDDEN, HAPI.H_CONSTRAINT_BACKWARD_EDGE_REQUIRED, HAPI.H_CONSTRAINT_EDGE_FORBIDDEN, HAPI.H_CONSTRAINT_EDGE_REQUIRED, HAPI.H_CONSTRAINT_FORWARD_EDGE_FORBIDDEN, HAPI.H_CONSTRAINT_FORWARD_EDGE_REQUIRED or HAPI.H_CONSTRAINT_NONE |
void
A.setEdgeConstraint(B, HAPI.H_CONSTRAINT_NONE);
this.switchParent = function switchParent( oldParent, newParent )
Replace the given parent node with the new node. The old and new parent must be compatible. That is, they must be of the same class, and have an identical state set.
oldParent | a Node, the old parent. |
newParent | a Node, the new parent. |
void
C.switchParent(A, B);
this.caseIsSet = function caseIsSet( caseindex )
Returns true if a value has been set for this continuous chance or discete node in case caseindex; otherwise, returns false.
Notice: Only possible for discrete and continuous nodes.
caseindex | the case index represented as an integer. |
a boolean
isset = CC.caseIsSet(10);
this.getAlpha = function getAlpha( i )
Returns the alpha component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i.
i | the index of a discrete parent configuration. an integer. |
A real number.
alpha = CC.getAlpha(2);
this.getBeta = function getBeta( parent, i )
Returns the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i.
parent | a Node object; must be a continuous chance node. |
i | the index of a discrete parent configuration. an integer. |
A real number.
beta = CC.getBeta(P, 2);
this.getCaseValue = function getCaseValue( caseindex )
Returns the value set for this continuous chance node in case caseindex.
caseindex | the case index. an integer. |
A real number.
caseval = CC.getCaseValue(10);
this.getDistribution = function getDistribution()
Returns the distribution for this continuous node. The distribution for a continuous chance node is in general a mixture of several Gaussian distributions. This method actually computes a joint distribution of this CG node and a set of discrete nodes. These discrete nodes are chosen such that the computed marginal is a strong marginal, but it is not necessarily minimal.
A Table.
t = CC.getDistribution();
this.getGamma = function getGamma( i )
Returns the gamma component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i.
i | the index of a discrete parent configuration. an integer. |
A real number.
gamma = CC.getGamma(2);
this.getMean = function getMean()
Returns the mean of the marginal distribution of this continuous chance node.
A real number.
mean = CC.getMean();
this.getPropagatedValue = function getPropagatedValue()
Retrieves the value that has been propagated for this continuous chance Node. That is, the value incorporated in the current junction tree potentials as the state of this node.
A real number.
value = CC.getPropagatedValue();
this.getSampledValue = function getSampledValue()
Returns the value of this function or continuous chance Node for the configuration generated by the most recent call to Domain.simulate.
Notice: Only possible for continuous and function nodes.
A real number.
value = N.getSampledValue();
this.hasExperienceTable = function hasExperienceTable()
Returns true if this continuous or discrete chance Node has an experience table; returns false otherwise.
Notice: Only possible for discrete and continuous chance nodes.
A boolean.
hasTable = CC.hasExperienceTable();
this.setAlpha = function setAlpha( alpha, i )
Sets the alpha component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i.
alpha | the value of the alpha component. a real number. |
i | the index of a discrete parent configuration. an integer. |
void
CC.setAlpha(0.5, 1);
this.setBeta = function setBeta( beta, parent, i )
Sets the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i.
beta | the value of the beta component. a real number. |
parent | a Node object; must be a continuous chance node. |
i | the index of a discrete parent configuration. an integer. |
void
CC.setBeta(0.5, P, 1);
this.setCaseValue = function setCaseValue( c, value )
Sets the value of this continuous chance node to value in case c.
c | the case index represented as an integer. |
value | the value represented as a real number. |
void
CC.setCaseValue(10, 0.5);
this.setGamma = function setGamma( gamma, i )
Sets the gamma component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i.
gamma | the value of the gamma component. a real number. |
i | the index of a discrete parent configuration. an integer. |
void
CC.setGamma(0.5, 1);
this.unsetCase = function unsetCase( caseindex )
Specifies that the value of this continuous chance or discrete node is “unknown” for case caseindex.
Notice: Only possible for discrete and continuous nodes.
caseindex | the case index represented as an integer. |
void
CC.unsetCase(10);
this.computeSensitivityData = function computeSensitivityData( state )
Computes the constants of the sensitivity functions for the specified output probability and all CPT/policy parameters in the network.
This method simply calls Node.computeSensitivityData with the specified output probability as argument.
Notice: Only possible for discrete chance nodes.
state | the index of a state of this node - the probability of this state is the desired output probability. |
void
N.computeSensitivityData(1);
this.getRequisiteAncestors = function getRequisiteAncestors()
Get an array of Nodes containing the requisite ancestors of this decision Node.
The requisite ancestors are found by augmenting the network with additional information links as prescribed by the “no-forgetting” rule (which states that past observations and decisions are taken into account by all future decisions) and applying the minimal reduction algorithm for LIMIDs.
Notice: Only possible for discrete decision nodes.
an array of Nodes.
requisite = n.getRequisiteAncestors();
this.getRequisiteParents = function getRequisiteParents()
Get an array of Nodes containing the requisite parents of this decision Node.
Notice: Only possible for discrete decision nodes.
an array of Nodes.
requisite = n.getRequisiteParents();
this.enterFinding = function enterFinding( state, finding )
Specifies a finding value for a given state with all other states unaffected.
Notice: Only possible for discrete nodes.
state | an integer representing the state to be selected. States are numbered consecutively from 0 and upwards. |
finding | A nonnegative real number as the finding value. |
void
N.enterFinding(1, 0.5);
this.getCaseState = function getCaseState( c )
Returns the state of this discrete node for case c.
Notice: Only possible for discrete nodes.
c | the case index (an integer in the range 0, ..., number of cases) |
an integer.
state = N.getCaseState(10);
this.getEnteredFinding = function getEnteredFinding( state )
Returns the entered finding for the specified state of this node.
Notice: Only possible for discrete nodes.
state | an integer value representing which state to examine. |
A real number.
enteredFinding = N.getEnteredFinding(0);
this.getMutualInformation = function getMutualInformation( node )
Computes the mutual information between this discrete Node and the specified discrete Node.
Notice: Only possible for discrete nodes.
node | a discrete Node |
A real number.
mi = A.getMutualInformation(B);
this.getPropagatedFinding = function getPropagatedFinding( state )
Returns the propagated finding. That is, it returns the finding value incorporated within the current junction tree potentials for the specified {state} of this node.
Notice: Only possible for discrete nodes.
state | an integer representing the state to be examined. |
A real number.
probFind = N.getPropagatedFinding(1);
this.getSampledState = function getSampledState()
Returns the state index of this discrete node for the configuration generated by the most recent call to Domain.simulate.
Notice: Only possible for discrete nodes.
An integer. The state index.
state = N.getSampledState();
this.getSensitivityConstants = function getSensitivityConstants( input )
Returns the four constants of the specified sensitivity function. The output probability of this function was specified in the preceding call to Domain.computeSensitivityData. If the results produced by that call have been invalidated, an error is returned.
Notice: Only possible for discrete nodes.
input | specifies a conditional probability (or policy) parameter of this node (i.e., input is the index of an entry in the CPT/policy of this node). An integer. |
the four constants of the specified sensitivity function | an array of real numbers. |
constants = N.getSensitivityConstants(0);
this.getSensitivityConstantsByOutput = function getSensitivityConstantsByOutput( input, output )
Returns the four constants of the specified sensitivity function. The output probability of this function must be one of the output probabilities specified in the preceding call to Domain.computeSensitivityData. If the results produced by that call have been invalidated, an error is returned.
Notice: Only possible for discrete nodes.
input | specifies a conditional probability (or policy) parameter of this node (i.e., input is the index of an entry in the CPT/policy of this node). An integer. |
output | identifies one of the output probabilities specified in the call to Domain.computeSensitivityData. An integer. |
the four constants of the specified sensitivity function | an array of real numbers. |
constants = N.getSensitivityConstantsByOutput(0, 0);
this.setCaseState = function setCaseState( c, state )
Sets the state of this discrete node to state in case c.
Notice: Only possible for discrete nodes.
c | the case index represented as an integer. |
state | the state represented as an integer. |
void
N.setCaseState(10, 1);
this.getStateIndexFromLabel = function getStateIndexFromLabel( label )
Returns the index of the state matching the specified label. If there is no (unique) state with the specified state label, -1 is returned.
Notice: Only possible for discrete nodes.
label | the state label to search for |
An integer. A state index.
state = N.getStateIndexFromLabel("State 1");
this.computeExplanationData = function computeExplanationData( x, Y, y, maxSubsetSize )
Computes Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size. Two hypotheses are compared: (this node)=x and Y=y. For each subset of evidence nodes (up to the specified maximum size), the Bayes factor (the support for the first hypothesis relative to the second hypothesis) is computed. The results of the computations can be accessed using Domain.getExplanation and Domain.getExplanationScore.
Notice: Only possible for discrete nodes.
x | state of the primary hypothesis node (this discrete Node) |
Y | the alternative hypothesis Node (a discrete node) |
y | state of the alternative hypothesis node |
maxSubsetSize | data for all subsets of evidence nodes up to this size are computed |
void
this.computeExplanationData2 = function computeExplanationData2( x, maxSubsetSize )
Computes “normalized likelihoods” for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size. For each subset of evidence nodes (up to the specified maximum size), the normalized likelihood of the hypothesis is computed. The results of the computations can be accessed using Domain.getExplanation and Domain.getExplanationScore.
Notice: Only possible for discrete nodes.
x | state of the hypothesis node (this discrete Node) |
maxSubsetSize | data for all subsets of evidence nodes up to this size are computed |
void
this.addToInputs = function addToInputs()
Makes this Node become an input node of its Class. The node must not already be an input or output node of its class, it must not be an output clone associated with an instancenode, and, most importantly, it must not have parents.
Notice: Only possible for nodes of a Class.
void
this.createTemporalClone = function createTemporalClone()
Constructs a temporal clone of this Node. This node (known as the “master” node) must not be an instance node, or a temporal or an output clone, and the node must belong to a class without input and output nodes. Moreover, this class must not be instantiated. Only one temporal clone can be created for each master node.
Notice: Only possible for nodes of a Class.
a Node
this.getHome = function getHome()
Returns the NetworkModel containing this Node.
net = N.getHome();
this.getInstance = function getInstance()
Returns the instance Node containing this (cloned) output node. Or an error if this is not an output node. Note that we clone all output nodes when we create an instance node. This is done in order to make it possible to specify conditional probability tables involving output nodes from instance nodes.
Notice: Only possible for nodes of a Class.
a Node object
this.getMaster = function getMaster()
Returns the “master” of this (cloned) output Node of an instance node (i.e., the node cloned to get this output node). Or an error if node is not cloned output. Note that “master” belongs to another Class. Note also that we clone all output nodes when we create an instance node. This is done in order to make it possible to specify conditional probability tables involving output nodes from instance nodes.
Notice: Only possible for nodes of a Class.
a Node object
this.getSource = function getSource()
Get an array of Nodes of Class nodes that identifies this Domain node.
The Class.createDomain method of the Class unfolds an object-oriented (nested) specification of a Bayesian network or a LIMID into a regular Domain.
Nodes in this Domain which originates from nodes residing in nested sub-networks (via instance nodes) can be uniquely related to a sequence of instance node Node and an ordinary Node of the object-oriented network.
Notice: Only possible for nodes of a Domain.
an array of Nodes (the source list)
source = n.getSource();
this.getPredictedBelief = function getPredictedBelief( state, time )
Returns the predicted belief for the specified state of this discrete Node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions.
state | an integer value representing which state to examine. |
time | time slice index (a nonnegative integer less than the number of predicted time slices) |
A real number representing the belief at the specified time point.
this.getPredictedValue = function getPredictedValue( time )
Gets the predicted value of this FunctionNode at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions. Notice: Only possible for function nodes.
time | time slice index (a nonnegative integer less than the number of predicted time slices) |
A real number representing the predicted value at the specified time point.
this.getPredictedMean = function getPredictedMean( time )
Returns the predicted mean of the marginal distribution of this continuous chance node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions. Notice: Only possible for continuous nodes.
time | time slice index (a nonnegative integer less than the number of predicted time slices) |
A real number representing the predicted mean of the marginal distribution of this continuous chance node at the specified time point.
this.getPredictedVariance = function getPredictedVariance( time )
Returns the predicted variance of the marginal distribution of this continuous chance node at the specified time point. This method accesses the predictions computed by a previous call to Domain.computeDBNPredictions. Notice: Only possible for continuous nodes.
time | time slice index (a nonnegative integer less than the number of predicted time slices) |
A real number representing the predicted variance of the marginal distribution of this continuous chance node at specified time.
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.
Tables are acquired using the Node.getTable function.
Functions | |
getHAPI | Get the HAPI object that owns this Table |
deleteObject | Deletes this Table. |
getSize | Get the size of this Table. |
getNodes | Get all Nodes associated with this Table. |
getDataItem | Get the data item at position index of the discrete data of this Table. |
setDataItem | Sets a specific data item of the discrete data of this Table. |
setData | Sets a region of the discrete data of this Table. |
getData | Gets a region of the discrete data of this Table. |
getMean | Get the mean of a continuous chance Node given a configuration of the discrete chance Nodes of this Table. |
getVariance | Get the variance of a continuous chance Node given a configuration of the discrete chance Nodes of this Table. |
getCovariance | Get the covariance of a pair of continuous chance Nodes given a configuration of the discrete chance Nodes of this Table. |
computeProbabilityOfInterval | Compute the probability of a given interval for the mixture distribution represented by this Table. |
reorderNodes | Reorders the list of Nodes of this Table. |
getCGSize | Returns the CG size of this Table. |
setAllDataItems | Sets all data items of the discrete data of this Table. |
this.deleteObject = function deleteObject()
Deletes this Table.
void
t.deleteObject();
this.getDataItem = function getDataItem( index )
Get 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.
index | the index of the data item |
A real number; the data item at requested index.
data0 = t.getDataItem(0); data1 = t.getDataItem(1); data2 = t.getDataItem(2); data3 = t.getDataItem(3);
this.setDataItem = function setDataItem( index, value )
Sets a specific data item of the discrete data of this Table.
index | index of the data item to set |
value | real number; the new value of the data item at the specified index. |
void
t.setDataItem(0, 0.3); t.setDataItem(1, 0.4); t.setDataItem(2, 0.8); t.setDataItem(3, 0.05);
this.setData = function setData( data, startIndex, count )
Sets a region of the discrete data of this Table. The region is specified by a start position and the number of elements to copy. The data is copied from the data array to the table.
The indexes startIndex, ..., startIndex+count-1 must be valid indexes of this table. Also, count must be less than or equal to the size of the data array.
data | array of real numbers holding the data to copy to this table |
startIndex | index of the first element to be set |
count | number of elements to copy |
void
dataItems = [0.3, 0.4, 0.8, 0.05]; t.setData(dataItems, 0, 4);
this.getData = function getData( startIndex, count )
Gets a region of the discrete data of this Table. The region is specified by a start position and the number of elements to copy.
The indexes startIndex, ..., startIndex+count-1 must be valid indexes of this Table.
startIndex | index of the first element to get |
count | number of elemets to retrieve |
Requested region of data items as an array of real numbers
dataItems = t.getData(0, 4);
this.getMean = function getMean( index, node )
Get the mean of a continuous chance Node given a configuration of the discrete chance Nodes of this Table.
index | the index of the discrete configuration. |
node | continuous chance Node. |
a real number; the mean of a continuous chance Node given a configuration of the discrete chance Nodes of this Table.
mean = t.getMean(i, n);
this.getVariance = function getVariance( index, node )
Get the variance of a continuous chance Node given a configuration of the discrete chance Nodes of this Table.
index | the index of the discrete configuration. |
node | continuous chance Node. |
a real number; the variance of a continuous chance Node given a configuration of the discrete chance Nodes of this Table.
variance = t.getVariance(i, n);
this.getCovariance = function getCovariance( index, node1, node2 )
Get the covariance of a pair of continuous chance Nodes given a configuration of the discrete chance Nodes of this Table.
index | the index of the discrete configuration. |
node1 | continuous chance Node. |
node2 | continuous chance Node. |
a real number; the covariance of a pair of continuous chance Nodes given a configuration of the discrete chance Nodes of this Table.
covariance = t.getCovariance(i, n1, n2);
this.computeProbabilityOfInterval = function computeProbabilityOfInterval( x, y )
Compute the probability of a given interval for the mixture distribution represented by this Table.
x | the left endpoint of the interval. |
y | the right endpoint of the interval. |
a real number; the probability of the given interval.
probability = t.computeProbabilityOfInterval(x, y);
this.getCGSize = function getCGSize()
Returns the CG size of this Table. This is the number of CG data elements stored in the table.
an integer; the number of CG data elements stored in the table.
cgsize = t.getCGSize();
A Model is a compact description of a table. A model consists of a list of discrete nodes and a set of expressions (one expression per configuration of states of the nodes.
Models are created using Domain.getNewModel and acquired from nodes using the Node.getModel function.
Functions | |
getHAPI | Get the HAPI object that owns this Model |
deleteObject | Deletes this Model. |
setExpression | Associates an expression (specified as a string) with a specific configuration of the Nodes of this Model. |
getExpression | Returns the expression (as a string) associated with a specific configuration of the NodeResources of this ModelResource. |
setNumberOfSamplesPerInterval | Sets the number of values taken within each bounded interval of an interval parent when generating the conditional probability table for a node with interval parents. |
getNumberOfSamplesPerInterval | Gets the number of values per interval used when generating the conditional probability table for a node with interval parents. |
getSize | Returns the number of configurations of the Node of this Model. |
getNodes | Get all Nodes in this Model. |
this.deleteObject = function deleteObject()
Deletes this Model.
void
m.deleteObject();
this.setExpression = function setExpression( index, expression )
Associates an expression (specified as a string) with a specific configuration of the Nodes of this Model.
index | index of configuration |
expression | the expression as a string |
void
m.setExpression(0, "true");
this.getExpression = function getExpression( index )
Returns the expression (as a string) associated with a specific configuration of the NodeResources of this ModelResource.
index | index of configuration |
a string representation of the expression associated with configuration index of the Node of this Model.
expr = m.getExpression(0);
this.setNumberOfSamplesPerInterval = function setNumberOfSamplesPerInterval( count )
Sets the number of values taken within each bounded interval of an interval parent when generating the conditional probability table for a node with interval parents.
When generating the conditional probability table for a node with interval nodes as parents, a number of values are taken within each bounded interval of an interval parent. By default, the interval is divided into 25 subintervals, and the midpoints of these subintervals are then used in the computation of the value of the child.
count | the number of subintervals (an integer). |
void
m.setNumberOfSamplesPerInterval(20);
this.getNumberOfSamplesPerInterval = function getNumberOfSamplesPerInterval()
Gets the number of values per interval used when generating the conditional probability table for a node with interval parents.
requested number of samples per interval (an integer).
numSam = m.getNumberOfSamplesPerInterval();
Cliques represents the cliques in the junction tree.
Cliques are acquired using JunctionTree.getCliques, JunctionTree.getRoot and Clique.getNeighbors functions. JunctionTrees are acquired using the Domain.getJunctionTrees function.
Functions | |
getHAPI | Get the HAPI object that owns this Clique |
getJunctionTree | Get the JunctionTree to which this Clique belongs. |
getMembers | Get the list of Nodes that are members of this Clique. |
getNeighbors | Get a list of Cliques that are neighbors of this Clique. |
this.getJunctionTree = function getJunctionTree()
Get the JunctionTree to which this Clique belongs.
the JunctionTree to which this Clique belongs.
jt = c.getJunctionTree();
JunctionTrees represents the junction trees in the compiled Domain.
JunctionTrees are acquired using the Domain.getJunctionTrees function.
Functions | |
getHAPI | Get the HAPI object that owns this JunctionTree |
cgEvidenceIsPropagated | Check if CG evidence has been propagated in this JunctionTree. |
equilibriumIs | Tests the Equilibrium type. |
evidenceIsPropagated | Tests if evidence has been propagated for this JunctionTree. |
evidenceModeIs | Tests the EvidenceMode. |
evidenceToPropagate | Tests if evidence has been entered since the last propagation. |
getCliques | Get the list of Cliques in this JunctionTree. |
getConflict | Get the conflict measure of the data inserted in this JunctionTree. |
getRoot | Get the root Clique of this JunctionTree. |
getTotalCGSize | Get the total number of CG table entries for this JunctionTree. |
getTotalSize | Get the total number of discrete table configurations for this JunctionTree. |
likelihoodIsPropagated | Tests if likelihoods have been propagated in this JunctionTree. |
tablesToPropagate | Tests if this JunctionTree contains updated tables that have not been propagated. |
propagate | Propagates evidence in this JunctionTree. |
this.getHAPI = function getHAPI()
Get the HAPI object that owns this JunctionTree
the owning HAPI instancs.
this.cgEvidenceIsPropagated = function cgEvidenceIsPropagated()
Check if CG evidence has been propagated in this JunctionTree.
Returns true if CG evidence has been propagated in this JunctionTree; otherwise, returns false.
cgIsPropagated = jt.cgEvidenceIsPropagated();
this.equilibriumIs = function equilibriumIs( equilibrium )
Tests the Equilibrium type. Returns true if the equilibrium of this JunctionTree can be obtained through a propagation using equilibrium as the Equilibrium type; otherwise, returns false.
equilibrium | the type of Equilibrium to test for. The normal Equilibrium type is HAPI.H_EQUILIBRIUM_SUM. |
Returns true if the equilibrium of this JunctionTree can be obtained through a propagation using equilibrium as the Equilibrium type; otherwise, returns false.
result = jt.equilibriumIs(HAPI.H_EQUILIBRIUM_SUM);
this.evidenceIsPropagated = function evidenceIsPropagated()
Tests if evidence has been propagated for this JunctionTree.
Returns true if evidence has been propagated; otherwise, returns false.
evidenceIsPropagated = jt.evidenceIsPropagated();
this.evidenceModeIs = function evidenceModeIs( mode )
Tests the EvidenceMode.
mode | the type of EvidenceMode to test for. The normal EvidenceMode type is HAPI.H_EVIDENCE_MODE_NORMAL. |
Returns true if the EvidenceMode matches mode; otherwise, returns false.
result = jt.evidenceModeIs(HAPI.H_EVIDENCE_MODE_NORMAL);
this.evidenceToPropagate = function evidenceToPropagate()
Tests if evidence has been entered since the last propagation.
Returns true if evidence has been entered since the last propagation; otherwise, returns false.
result = jt.evidenceToPropagate();
this.getCliques = function getCliques()
Get the list of Cliques in this JunctionTree.
An array of Cliques in this JunctionTree.
cliques = jt.getCliques();
this.getConflict = function getConflict()
Get the conflict measure of the data inserted in this JunctionTree.
Returns the conflict measure of the data inserted in this JunctionTree (a real number).
conflict = jt.getConflict();
this.getRoot = function getRoot()
Get the root Clique of this JunctionTree.
Returns the root Clique of this JunctionTree.
root = jt.getRoot();
this.getTotalCGSize = function getTotalCGSize()
Get the total number of CG table entries for this JunctionTree. Both clique and separator table entries are counted.
total number of CG table entries for this JunctionTree.
numEntries = jt.getTotalCGSize();
this.getTotalSize = function getTotalSize()
Get the total number of discrete table configurations for this JunctionTree. Both clique and separator table configurations are counted. Also, if the junction tree has utility potentials, then the clique and separator configurations will effectively be counted twice.
total number of discrete table configurations for this JunctionTree.
numConf = jt.getTotalSize();
this.likelihoodIsPropagated = function likelihoodIsPropagated()
Tests if likelihoods have been propagated in this JunctionTree.
Returns true if likelihoods have been propagated in this JunctionTree; otherwise, returns false.
likelihoodIsPropagated = jt.likelihoodIsPropagated();
this.tablesToPropagate = function tablesToPropagate()
Tests if this JunctionTree contains updated tables that have not been propagated.
Returns true if this JunctionTree contains updated tables that have not been propagated; otherwise, returns false.
result = jt.tablesToPropagate();
this.propagate = function propagate( equilibrium, evidenceMode )
Propagates evidence in this JunctionTree.
equilibrium | Equilibrium type. The normal Equilibrium type is HAPI.H_EQUILIBRIUM_SUM. |
evidenceMode | EvidenceMode type. The normal EvidenceMode type is HAPI.H_EVIDENCE_MODE_NORMAL. |
void
jt.propagate(HAPI.H_EQUILIBRIUM_SUM, HAPI.H_EVIDENCE_MODE_NORMAL);
Instances of the DataSet represents a data set as a “matrix” with cases as rows and variables as columns.
A DataSet is instantiated using one of the HAPI dataset functions HAPI.loadDataSet or HAPI.getNewDataSet.
Functions | |
getHAPI | Get the HAPI object that owns this DataSet |
deleteObject | Deletes this DataSet. |
deleteColumn | Deletes the specified column from this DataSet. |
deleteRow | Deletes the specified row from this DataSet. |
getColumnName | Returns the name of the specified column of this DataSet. |
getDataItem | Returns the data item at the specified location of this DataSet. |
getNumberOfColumns | Returns the number of columns in this DataSet. |
getNumberOfRows | Returns the number of rows in this DataSet. |
moveColumn | Moves the specified column to a new position. |
moveRow | Moves the specified row to a new position. |
newColumn | Creates a new column in this DataSet. |
newRow | Creates a new row in this DataSet. |
setColumnName | Sets the name of the specified column of this DataSet. |
setDataItem | Sets (or deletes) the data item at the specified location of this DataSet. |
save | Submits this DataSet in the form of a CSV file to the service located at a target URL. |
download | Generate an URL for downloading this DataSet as a CSV file |
this.deleteColumn = function deleteColumn( column )
Deletes the specified column from this DataSet.
column | the index of the column to be deleted. |
void
d.deleteColumn(0);
this.deleteRow = function deleteRow( row )
Deletes the specified row from this DataSet.
row | the index of the row to be deleted. |
void
d.deleteRow(0);
this.moveColumn = function moveColumn( column, newColumn )
Moves the specified column to a new position. The columns between the old and the new column positions will be shifted one position to the left or to the right depending on the direction of the move.
column | the index of the column to be moved |
newColumn | the index of the destination column |
void
d.moveColumn(0, 2);
this.moveRow = function moveRow( row, newRow )
Moves the specified row to a new position. The rows between the old and the new row positions will be shifted one position to the left or to the right depending on the direction of the move.
row | the index of the row to be moved. |
newRow | the index of the destination row. |
void
d.moveRow(0, 2);
this.newColumn = function newColumn( name )
Creates a new column in this DataSet.
name | the name of the new column. |
integer; index of new column
d.newColumn('mycolumn');
this.newRow = function newRow()
Creates a new row in this DataSet.
integer; index of new row
d.newRow();
this.setColumnName = function setColumnName( column, name )
Sets the name of the specified column of this DataSet.
column | the index of the column. |
name | the new name of the column. |
void
d.setColumnName(2, 'mynewname');
this.setDataItem = function setDataItem( row, column, data )
Sets (or deletes) the data item at the specified location of this DataSet.
row | the index of the row. |
column | the index of the column. |
data | the new data item (the empty string causes the item to be deleted). |
void
d.setDataItem(10, 2, 'mydata');
this.save = function save( url, method, delimiter )
Submits this DataSet in the form of a CSV file to the service located at a target URL.
URL | the URL to submit CSV file |
method | the HTTP method to use: POST | PUT |
delimiter | CSV delimiter character |
void
d.save("http://somehost/someservice", "POST", ";");
this.download = function download( delimiter, filename )
Generate an URL for downloading this DataSet as a CSV file
delimiter | CSV delimiter character |
filename | used for setting the Content-Disposition filename header of response. |
the URL as a string
url = d.download(',', "data.csv");
Constants | |
HAPI. | Represents the domain knowledge that a directed edge is forbidden from the second to the first Node in an ordered pair of Nodes. |
HAPI. | Represents the domain knowledge that a directed edge is required from the second to the first Node in an ordered pair of Nodes. |
HAPI. | Represents the domain knowledge that an edge is forbidden between a particular pair of Nodes. |
HAPI. | Represents the domain knowledge that an edge is required for a particular pair of Nodes. |
HAPI. | Represents the domain knowledge that a directed edge is forbidden from the first to the second Node in an ordered pair of Nodes. |
HAPI. | Represents the domain knowledge that a directed edge is required from the first to the second Node in an ordered pair of Nodes. |
HAPI. | Represents that no domain knowledge is available for a particular pair of Nodes. |
HAPI. | Represents the best-greedy triangulation heuristic. |
HAPI. | Represents the clique-size triangulation heuristic. |
HAPI. | Represents the clique-weight triangulation heuristic. |
HAPI. | Represents the fill-in-size triangulation heuristic. |
HAPI. | Represents the fill-in-weight triangulation heuristic. |
HAPI. | Represents the total clique-table size triangulation algorithm. |
HAPI. | Represents the normal evidence mode used for propagating evidence in this Domain. |
HAPI. | Represents the fast retraction evidence mode used for propagating evidence in this Domain. |
HAPI. | Represents max equilibrium. |
HAPI. | Represents sum equilibrium. |
HAPI. | Represents the Category tag attached to DecisionNodes. |
HAPI. | Represents the Category tag attached to FunctionNodes. |
HAPI. | Represents the Category tag attached to UtilityNodes. |
HAPI. | Represents the Category tag attached to ChanceNodes. |
HAPI. | Represents the Category tag attached to InstanceNodes. |
HAPI. | Represents the Kind tag attached to continuous nodes. |
HAPI. | Represents the Kind tag attached to discrete nodes. |
HAPI. | Represents the Kind tag attached to utility, function, and instance nodes. |
HAPI. | Represents the discrete node subtype for numbered nodes |
HAPI. | Represents the discrete node subtype for interval nodes |
HAPI. | Represents the discrete node subtype for boolean nodes |
HAPI. | Represents the discrete node subtype for labelled nodes |
HAPI. | Subtype placeholder for specifying node other than discrete. |
Represents the domain knowledge that an edge is forbidden between a particular pair of Nodes.
Represents the domain knowledge that an edge is required for a particular pair of Nodes.
Represents that no domain knowledge is available for a particular pair of Nodes.
Initializes a new instance of the HAPI class and binds it internally to the RESTful HUGIN Web Service API.
function HAPI( webServiceHome )
Construct an empty classcollection.
this.getNewClassCollection = function getNewClassCollection()
Construct a classcollection from a HUGIN Knowledge Base retrieved over HTTP.
this.loadClassCollection = function loadClassCollection( url )
Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL.
this.loadDomain = function loadDomain( url )
Instantiates a Domain object from a HUGIN Knowledge Base (HKB) file located at specifid URL.
this.loadCompileDomain = function loadCompileDomain( url )
Constructs a new empty Domain.
this.getNewDomain = function getNewDomain()
Instantiate a DataSet from a CSV file retrieved over HTTP.
this.loadDataSet = function loadDataSet( url, delimiter )
Construct an empty DataSet.
this.getNewDataSet = function getNewDataSet()
Refetch cached responses from remote decision engine.
this.refetch = function refetch( huginObject )
Constructs a new Batch object.
this.getNewBatch = function getNewBatch()
Get the HAPI object that owns this Batch
this.getHAPI = function getHAPI()
Reset the Batch.
this.reset = function reset()
Add a function call to the Batch queue.
this.add = function add( command //, arg1, arg2, arg3, ..., argN )
Execute the queued up function calls in a synchronously blocking fashion.
this.execute = function execute()
Dispatch execution of queued up function calls in an asynchronously non-blocking fashion.
this.dispatch = function dispatch( onSuccess, onError )
Get the HAPI object that owns this ClassCollection
this.getHAPI = function getHAPI()
Deletes this ClassCollection object, including all nested HUGIN objects belonging to it (e.g.
this.deleteObject = function deleteObject()
Returns a Class by name.
this.getClassByName = function getClassByName( name )
Get all Classes of this ClassCollection.
this.getMembers = function getMembers()
Submits this ClassCollection in the form of a HKB file to the service located at a target URL.
this.save = function save( url, method )
Generate an URL for downloading this ClassCollection as a HKB file
this.download = function download( filename )
Creates a new Class.
this.getNewClass = function getNewClass( name )
Get the HAPI object that owns this NetworkModel
this.getHAPI = function getHAPI()
Returns a Node by name.
this.getNodeByName = function getNodeByName( name )
Creates a new Node.
this.getNewNode = function getNewNode( category, kind, subtype )
Get all Nodes in this NetworkModel.
this.getNodes = function getNodes()
Generates the conditional probability tables for all nodes of this NetworkModel.
this.generateTables = function generateTables()
Returns an attribute value.
this.getAttribute = function getAttribute( key )
Parses the file retrieved from an URL and returns a list of Nodes.
this.parseNodes = function parseNodes( url )
Inserts the key/value pair in the attribute list for this NetworkModel.
this.setAttribute = function setAttribute( key, value )
Deletes this Class, including all Node objects belonging to it.
this.deleteObject = function deleteObject()
Creates a DBN runtime Domain from this Class.
this.createDBNDomain = function createDBNDomain( numberOfSlices )
Creates a flat runtime Domain from this Class.
this.createDomain = function createDomain()
Creates a new instance Node.
this.getNewInstanceNode = function getNewInstanceNode( instanceOf )
Get the ClassCollection to which this Class belongs.
this.getClassCollection = function getClassCollection()
Get all input Nodes defined for this Class.
this.getInputs = function getInputs()
Get all instance Nodes that are instances of this Class.
this.getInstances = function getInstances()
Get all output Nodes defined for this Class.
this.getOutputs = function getOutputs()
Returns the name of this Class.
this.getName = function getName()
Sets the name of this Class.
this.setName = function setName( name )
Deletes this Domain, including all Node and JunctionTree objects belonging to it.
this.deleteObject = function deleteObject()
Parses a case retrieved from an URL and enters the associated findings into this Domain.
this.parseCase = function parseCase( url )
Submits all evidence entered in this Domain to the service located at a target URL.
this.saveCase = function saveCase( url, method )
Submits this Domain in the form of a HKB file to the service located at a target URL.
this.save = function save( url, method )
Generate an URL for downloading this Domain as a HKB file
this.download = function download( filename )
Parses the cases retrieved form an URL and enters the cases into this Domain.
this.parseCases = function parseCases( url )
Submits all cases in this Domain to the service located at a target URL.
this.saveCases = function saveCases( url, method, nodes, cases, caseCounts, separator, missingData )
Establishes the specified equilibrium using the evidence mode indicated for incorporation of evidence on all JunctionTrees of this Domain.
this.propagate = function propagate( equilibrium, evidenceMode )
Compiles this Domain.
this.compile = function compile()
Adapts this Domain according to the evidence entered.
this.adapt = function adapt()
For each discrete node of this Domain (which must be a runtime domain) such that both the node and its source node have experience tables, the conditional probability and experience tables of both nodes are learned/updated, and the tables of the domain node will be identical to those of its source node.
this.adaptClassTablesUsingFractionalUpdate = function adaptClassTablesUsingFractionalUpdate()
This function updates (adapts), for all discrete chance nodes of this Domain, the experience count (retrieval of experience) and the conditional probability distribution (dissemination of experience) for all parent configurations having a valid experience count.
this.adaptClassTablesUsingOnlineEM = function adaptClassTablesUsingOnlineEM()
Removes “near-zero” probabilities from the clique probability tables.
this.approximate = function approximate( epsilon )
Check if evidence on CG nodes has been propagated.
this.cgEvidenceIsPropagated = function cgEvidenceIsPropagated()
Tests if evidence has been propagated for this Domain.
this.evidenceIsPropagated = function evidenceIsPropagated()
Tests if evidence has been entered since the last propagation.
this.evidenceToPropagate = function evidenceToPropagate()
Retracts (all) evidence for all nodes in this Domain.
this.retractFindings = function retractFindings()
Constructs a Model over a Node given a list of Nodes.
this.getNewModel = function getNewModel( belongsTo, modelNodes )
Gets the total expected utility associated with this Domain.
this.getExpectedUtility = function getExpectedUtility()
Tests whether this Domain is compiled.
this.isCompiled = function isCompiled()
Tests whether this Domain is triangulated.
this.isTriangulated = function isTriangulated()
Tests whether this Domain has been triangulated for Boyen-Koller approximate inference.
this.isTriangulatedForBK = function isTriangulatedForBK()
Establishes the initial values for all tables of this Domain (which must be compiled).
this.initialize = function initialize()
Gets all JunctionTrees of this Domain.
this.getJunctionTrees = function getJunctionTrees()
Removes the zero entries from the clique and separator tables of the junction trees in this Domain.
this.compress = function compress()
Computes the constants of the sensitivity functions for the specified output probabilities and all CPT parameters in the network.
this.computeSensitivityData = function computeSensitivityData( nodes, states )
Computes the log-likelihood of the case data.
this.getLogLikelihood = function getLogLikelihood()
Returns the log-likelihood tolerance for this Domain.
this.getLogLikelihoodTolerance = function getLogLikelihoodTolerance()
Returns the log of the normalization constant.
this.getLogNormalizationConstant = function getLogNormalizationConstant()
Returns a MAP configuration.
this.getMAPConfiguration = function getMAPConfiguration( index )
Computes the marginal distribution for the Nodes provided as argument with respect to the (imaginary) joint potential, determined by the current potentials on the JunctionTrees of this Domain.
this.getMarginal = function getMarginal( nodes )
Returns the maximum number of iterations allowed for the EM algorithm.
this.getMaxNumberOfEMIterations = function getMaxNumberOfEMIterations()
Returns the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method.
this.getMaxNumberOfSeparators = function getMaxNumberOfSeparators()
Use the pseudo-random number generator for this Domain to sample a real number from a normal (aka Gaussian) distribution.
this.getNormalDeviate = function getNormalDeviate( mean, variance )
Retrieves the normalization constant for the most recent propagation.
this.getNormalizationConstant = function getNormalizationConstant()
Returns the number of data cases.
this.getNumberOfCases = function getNumberOfCases()
Returns the number of MAP configurations.
this.getNumberOfMAPConfigurations = function getNumberOfMAPConfigurations()
Returns the probability of a MAP configuration.
this.getProbabilityOfMAPConfiguration = function getProbabilityOfMAPConfiguration( index )
Returns the sensitivity set computed by the most recent call to Domain.computeSensitivityData.
this.getSensitivitySet = function getSensitivitySet()
Returns the significance level of the dependency tests performed during structure learning using the PC-algorithm.
this.getSignificanceLevel = function getSignificanceLevel()
Use the pseudo-random number generator for this Domain to sample a real number from the uniform distribution over the interval [0,1).
this.getUniformDeviate = function getUniformDeviate()
Enters a case as evidence.
this.enterCase = function enterCase( index )
Tests the Equilibrium type.
this.equilibriumIs = function equilibriumIs( equilibrium )
Tests whether this Domain is compressed.
this.isCompressed = function isCompressed()
Tests for evidence mode.
this.evidenceModeIs = function evidenceModeIs( mode )
Learn the structure (graph) of the Bayesian network from data using the PC-algorithm.
this.learnStructure = function learnStructure()
Learns the conditional probability tables from data using the EM algorithm.
this.learnTables = function learnTables()
Tests if likelihood has been propagated for this Domain
this.likelihoodIsPropagated = function likelihoodIsPropagated()
Creates a new case.
this.newCase = function newCase()
Finds all configurations of nodes with probability at least minprobability.
this.findMAPConfigurations = function findMAPConfigurations( nodes, minprobability )
Computes the AIC score (Akaike’s Information Criterion) of the case data.
this.getAIC = function getAIC()
Returns the approximation constant.
this.getApproximationConstant = function getApproximationConstant()
Computes the BIC score (Bayesian Information Criterion) of the case data.
this.getBIC = function getBIC()
Returns case count for a case.
this.getCaseCount = function getCaseCount( caseindex )
Returns the conflict value.
this.getConflict = function getConflict()
Performs a d-separation test and returns a list of d-connected nodes.
this.getDConnectedNodes = function getDConnectedNodes( source, hard, soft )
Performs a d-separation test and returns a list of d-separated nodes.
this.getDSeparatedNodes = function getDSeparatedNodes( source, hard, soft )
Returns the triangulation order.
this.getEliminationOrder = function getEliminationOrder()
Establishes the initial state of the inference engine, which is sum-equilibrium with no evidence incorporated.
this.resetInferenceEngine = function resetInferenceEngine()
Creates a copy in memory of the belief and junction tree tables of this Domain.
this.saveToMemory = function saveToMemory()
Seeds the pseudo-random number generator for this Domain.
this.seedRandom = function seedRandom( seed )
Sets case count for a case.
this.setCaseCount = function setCaseCount( caseindex, count )
Sets the log-likelihood tolerance for this Domain.
this.setLogLikelihoodTolerance = function setLogLikelihoodTolerance( tolerance )
Sets the maximum number of iterations allowed for the EM algorithm.
this.setMaxNumberOfEMIterations = function setMaxNumberOfEMIterations( maxnumber )
Sets the maximum number of separators allowed when using the HAPI.H_TM_TOTAL_WEIGHT triangulation method.
this.setMaxNumberOfSeparators = function setMaxNumberOfSeparators( maxnumber )
Sets the number of cases.
this.setNumberOfCases = function setNumberOfCases( size )
Sets the significance level of the dependency tests performed during structure learning using the PC-algorithm.
this.setSignificanceLevel = function setSignificanceLevel( alpha )
Generates a sample configuration from the joint distribution represented by this Domain.
this.simulate = function simulate()
Generates a number of sample configurations by invoking Domain.simulate a number of times and for each iteration recording the results of Node.getSampledValue, Node.getSampledState or Node.getSampledUtility for specified Nodes.
this.batchSimulate = function batchSimulate( iterations, nodes )
Returns the value of this function or continuous chance Node for the configuration generated by the most recent call to Domain.simulate.
this.getSampledValue = function getSampledValue()
Returns the state index of this discrete node for the configuration generated by the most recent call to Domain.simulate.
this.getSampledState = function getSampledState()
Returns the sampled utility associated with this utility node.
this.getSampledUtility = function getSampledUtility()
Tests for new node tables.
this.tablesToPropagate = function tablesToPropagate()
Triangulates the graph of this Domain using the default triangulation method.
this.triangulate = function triangulate()
Uncompiles this Domain.
this.uncompile = function uncompile()
Updates the policy tables of the domain.
this.updatePolicies = function updatePolicies()
Returns the evidence subset associated with the explanation of rank index computed by the most recent call to Node.computeExplanationData.
this.getExplanation = function getExplanation( index )
Computes Bayes factor data for all (nonempty) subsets of evidence nodes up to the specified maximum size.
this.computeExplanationData = function computeExplanationData( x, Y, y, maxSubsetSize )
Returns the score of the specified explanation.
this.getExplanationScore = function getExplanationScore( index )
Returns the number of explanations.
this.getNumberOfExplanations = function getNumberOfExplanations()
Adds the specified range of rows of the data set to this Domain as cases.
this.addCases = function addCases( data, start, count )
Computes predictions for {numberOfTimePoints} time slices beyond the current time window.
this.computeDBNPredictions = function computeDBNPredictions()
Returns the total number of time steps that the time window of this DBN runtime domain has been moved.
this.getDBNWindowOffset = function getDBNWindowOffset()
Moves the time window of this DBN back to its initial position, and removes all evidence.
this.initializeDBNWindow = function initializeDBNWindow()
Slides the time window of this DBN delta steps into the future.
this.moveDBNWindow = function moveDBNWindow()
Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used.
this.triangulateDBN = function triangulateDBN( tm )
Triangulates a Domain produced by Class.createDBNDomain such that Domain.moveDBNWindow can be used.
this.triangulateDBNForBK = function triangulateDBNForBK( tm )
Get the HAPI object that owns this Node
this.getHAPI = function getHAPI()
Deletes this Node.
this.deleteObject = function deleteObject()
Gets the Model for this Node.
this.getModel = function getModel()
Returns the name of this Node.
this.getName = function getName()
Sets the name of this Node.
this.setName = function setName( name )
Sets the position of this Node.
this.setPosition = function setPosition( X, Y )
Returns the position of this Node on the X-axis.
this.getPositionX = function getPositionX()
Returns the position of this Node on the Y-axis.
this.getPositionY = function getPositionY()
Sets the number of states of this node.
this.setNumberOfStates = function setNumberOfStates( stateCount )
Get the number of states of this discrete node.
this.getNumberOfStates = function getNumberOfStates()
Sets the label of the specified state.
this.setStateLabel = function setStateLabel( state, newLabel )
Gets the label of the specified state.
this.getStateLabel = function getStateLabel( state )
Gets the Table associated with this Node.
this.getTable = function getTable()
Gets the belief for the specified state of this Node.
this.getBelief = function getBelief( state )
Get an array of parent Nodes for this Node.
this.getParents = function getParents()
Get an array of child Nodes for this Node.
this.getChildren = function getChildren()
Adds a Node as a new parent of this Node.
this.addParent = function addParent( parentNode )
Selects the specified state of this Node.
this.selectState = function selectState( state )
Gets (the index of) the selected state of this node.
this.getSelectedState = function getSelectedState()
Retracts all findings for this Node.
this.retractFindings = function retractFindings()
Gets the expected utility associated with this utility node or specified action of this discrete node.
this.getExpectedUtility = function getExpectedUtility( state )
Gets the value of this FunctionNode.
this.getValue = function getValue()
Sets the function associated with this function node to a number value.
this.setValue = function setValue( value )
Test if the evidence potential, currently registered with this Node, is non-vacuous.
this.evidenceIsEntered = function evidenceIsEntered()
Get the index of the state matching the specified value.
this.getStateIndex = function getStateIndex( value )
Gets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node.
this.getStateValue = function getStateValue( state )
Sets the value associated with a particular state of this numbered node or the low value of the interval associated with a particular state of this interval node.
this.setStateValue = function setStateValue( state, value )
Enters evidence (observation of the value) for this continuous chance node.
this.enterValue = function enterValue( value )
Gets the evidence (value) entered for this continuous chance node.
this.getEnteredValue = function getEnteredValue()
Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is non-vacuous; otherwise, returns false.
this.evidenceIsPropagated = function evidenceIsPropagated()
Returns true if the entered and the propagated evidence differ; otherwise, returns false.
this.evidenceToPropagate = function evidenceToPropagate()
Returns an attribute value.
this.getAttribute = function getAttribute( key )
Returns the category of this Node.
this.getCategory = function getCategory()
Returns the constraint between this and Node.
this.getEdgeConstraint = function getEdgeConstraint( node )
Returns the Domain containing this Node.
this.getHomeDomain = function getHomeDomain()
Returns the JunctionTree to which this Node belongs.
this.getJunctionTree = function getJunctionTree()
Returns the kind of this Node.
this.getKind = function getKind()
Returns the subtype of this Node.
this.getSubtype = function getSubtype()
Returns the label of this Node.
this.getLabel = function getLabel()
Returns true if the evidence potential for this Node, incorporated within the current junction tree potentials, is a likelihood; otherwise, returns false.
this.likelihoodIsPropagated = function likelihoodIsPropagated()
Returns true if the evidence potential, currently registered with this Node, is a likelihood; otherwise, returns false.
this.likelihoodIsEntered = function likelihoodIsEntered()
Removes the directed link between a parent and this Node.
this.removeParent = function removeParent( node )
Reverses the edge between this Node and the specified neighbor.
this.reverseEdge = function reverseEdge( node )
Sets a value for a particular attribute in the attribute list for this Node.
this.setAttribute = function setAttribute( key, value )
Sets a constraint between this Node and another Node.
this.setEdgeConstraint = function setEdgeConstraint( node, constraint )
Sets the label of this Node.
this.setLabel = function setLabel( label )
Replace the given parent node with the new node.
this.switchParent = function switchParent( oldParent, newParent )
Returns true if a value has been set for this continuous chance or discete node in case caseindex; otherwise, returns false.
this.caseIsSet = function caseIsSet( caseindex )
Returns the alpha component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i.
this.getAlpha = function getAlpha( i )
Returns the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i.
this.getBeta = function getBeta( parent, i )
Returns the value set for this continuous chance node in case caseindex.
this.getCaseValue = function getCaseValue( caseindex )
Returns the distribution for this continuous node.
this.getDistribution = function getDistribution()
Returns the experience table of this continuous or discrete chance node.
this.getExperienceTable = function getExperienceTable()
Returns the gamma component of the CG distribution of this continuous chance node given the discrete parent configuration corresponding to i.
this.getGamma = function getGamma( i )
Returns the mean of the marginal distribution of this continuous chance node.
this.getMean = function getMean()
Retrieves the value that has been propagated for this continuous chance Node.
this.getPropagatedValue = function getPropagatedValue()
Returns the variance of the marginal distribution of this continuous chance Node.
this.getVariance = function getVariance()
Returns true if this continuous or discrete chance Node has an experience table; returns false otherwise.
this.hasExperienceTable = function hasExperienceTable()
Sets the alpha component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i.
this.setAlpha = function setAlpha( alpha, i )
Sets the beta component of the CG distribution of this continuous chance node given a continuous parent and the discrete parent configuration corresponding to i.
this.setBeta = function setBeta( beta, parent, i )
Sets the value of this continuous chance node to value in case c.
this.setCaseValue = function setCaseValue( c, value )
Sets the gamma component of the CG distribution of this continuous chance Node given the discrete parent configuration corresponding to i.
this.setGamma = function setGamma( gamma, i )
Specifies that the value of this continuous chance or discrete node is “unknown” for case caseindex.
this.unsetCase = function unsetCase( caseindex )
Computes the constants of the sensitivity functions for the specified output probability and all CPT/policy parameters in the network.
this.computeSensitivityData = function computeSensitivityData( state )
Returns the fading table of this discrete chance node.
this.getFadingTable = function getFadingTable()
Returns true if this discrete chance Node has a fading table; returns false otherwise.
this.hasFadingTable = function hasFadingTable()
Get an array of Nodes containing the requisite ancestors of this decision Node.
this.getRequisiteAncestors = function getRequisiteAncestors()
Get an array of Nodes containing the requisite parents of this decision Node.
this.getRequisiteParents = function getRequisiteParents()
Specifies a finding value for a given state with all other states unaffected.
this.enterFinding = function enterFinding( state, finding )
Generates the table of this discrete Node from its Model (a missing Model will trigger an error).
this.generateTable = function generateTable()
Returns the state of this discrete node for case c.
this.getCaseState = function getCaseState( c )
Returns the entered finding for the specified state of this node.
this.getEnteredFinding = function getEnteredFinding( state )
Computes the entropy of this node.
this.getEntropy = function getEntropy()
Computes the mutual information between this discrete Node and the specified discrete Node.
this.getMutualInformation = function getMutualInformation( node )
Returns the propagated finding.
this.getPropagatedFinding = function getPropagatedFinding( state )
Returns the four constants of the specified sensitivity function.
this.getSensitivityConstants = function getSensitivityConstants( input )
Returns the four constants of the specified sensitivity function.
this.getSensitivityConstantsByOutput = function getSensitivityConstantsByOutput( input, output )
Sets the state of this discrete node to state in case c.
this.setCaseState = function setCaseState( c, state )
Returns the index of the state matching the specified label.
this.getStateIndexFromLabel = function getStateIndexFromLabel( label )
Computes “normalized likelihoods” for the specified hypothesis and all (nonempty) subsets of evidence nodes up to the specified maximum size.
this.computeExplanationData2 = function computeExplanationData2( x, maxSubsetSize )
Makes this Node become an input node of its Class.
this.addToInputs = function addToInputs()
Makes this Node become an output node of its Class.
this.addToOutputs = function addToOutputs()
Constructs a temporal clone of this Node.
this.createTemporalClone = function createTemporalClone()
Returns the NetworkModel containing this Node.
this.getHome = function getHome()
Returns the Class containing this Node.
this.getHomeClass = function getHomeClass()
Returns the instance Node containing this (cloned) output node.
this.getInstance = function getInstance()
Returns the “master” of this (cloned) output Node of an instance node (i.e., the node cloned to get this output node).
this.getMaster = function getMaster()
Get an array of Nodes of Class nodes that identifies this Domain node.
this.getSource = function getSource()
Get the “temporal clone” of this Node.
this.getTemporalClone = function getTemporalClone()
Get the “temporal master” of this Node.
this.getTemporalMaster = function getTemporalMaster()
Removes this Node from the set of input nodes of its class.
this.removeFromInputs = function removeFromInputs()
Removes this Node from the set of output nodes of its class.
this.removeFromOutputs = function removeFromOutputs()
Returns the predicted belief for the specified state of this discrete Node at the specified time point.
this.getPredictedBelief = function getPredictedBelief( state, time )
Gets the predicted value of this FunctionNode at the specified time point.
this.getPredictedValue = function getPredictedValue( time )
Returns the predicted mean of the marginal distribution of this continuous chance node at the specified time point.
this.getPredictedMean = function getPredictedMean( time )
Returns the predicted variance of the marginal distribution of this continuous chance node at the specified time point.
this.getPredictedVariance = function getPredictedVariance( time )
Get the HAPI object that owns this Table
this.getHAPI = function getHAPI()
Deletes this Table.
this.deleteObject = function deleteObject()
Get the size of this Table.
this.getSize = function getSize()
Get all Nodes associated with this Table.
this.getNodes = function getNodes()
Get the data item at position index of the discrete data of this Table.
this.getDataItem = function getDataItem( index )
Sets a specific data item of the discrete data of this Table.
this.setDataItem = function setDataItem( index, value )
Sets a region of the discrete data of this Table.
this.setData = function setData( data, startIndex, count )
Gets a region of the discrete data of this Table.
this.getData = function getData( startIndex, count )
Get the mean of a continuous chance Node given a configuration of the discrete chance Nodes of this Table.
this.getMean = function getMean( index, node )
Get the variance of a continuous chance Node given a configuration of the discrete chance Nodes of this Table.
this.getVariance = function getVariance( index, node )
Get the covariance of a pair of continuous chance Nodes given a configuration of the discrete chance Nodes of this Table.
this.getCovariance = function getCovariance( index, node1, node2 )
Compute the probability of a given interval for the mixture distribution represented by this Table.
this.computeProbabilityOfInterval = function computeProbabilityOfInterval( x, y )
Reorders the list of Nodes of this Table.
this.reorderNodes = function reorderNodes( nodes )
Returns the CG size of this Table.
this.getCGSize = function getCGSize()
Sets all data items of the discrete data of this Table.
this.setAllDataItems = function setAllDataItems( value )
Get the HAPI object that owns this Model
this.getHAPI = function getHAPI()
Deletes this Model.
this.deleteObject = function deleteObject()
Associates an expression (specified as a string) with a specific configuration of the Nodes of this Model.
this.setExpression = function setExpression( index, expression )
Returns the expression (as a string) associated with a specific configuration of the NodeResources of this ModelResource.
this.getExpression = function getExpression( index )
Sets the number of values taken within each bounded interval of an interval parent when generating the conditional probability table for a node with interval parents.
this.setNumberOfSamplesPerInterval = function setNumberOfSamplesPerInterval( count )
Gets the number of values per interval used when generating the conditional probability table for a node with interval parents.
this.getNumberOfSamplesPerInterval = function getNumberOfSamplesPerInterval()
Returns the number of configurations of the Node of this Model.
this.getSize = function getSize()
Get all Nodes in this Model.
this.getNodes = function getNodes()
Get the HAPI object that owns this Clique
this.getHAPI = function getHAPI()
Get the JunctionTree to which this Clique belongs.
this.getJunctionTree = function getJunctionTree()
Get the list of Nodes that are members of this Clique.
this.getMembers = function getMembers()
Get a list of Cliques that are neighbors of this Clique.
this.getNeighbors = function getNeighbors()
Get the HAPI object that owns this JunctionTree
this.getHAPI = function getHAPI()
Check if CG evidence has been propagated in this JunctionTree.
this.cgEvidenceIsPropagated = function cgEvidenceIsPropagated()
Tests the Equilibrium type.
this.equilibriumIs = function equilibriumIs( equilibrium )
Tests if evidence has been propagated for this JunctionTree.
this.evidenceIsPropagated = function evidenceIsPropagated()
Tests the EvidenceMode.
this.evidenceModeIs = function evidenceModeIs( mode )
Tests if evidence has been entered since the last propagation.
this.evidenceToPropagate = function evidenceToPropagate()
Get the list of Cliques in this JunctionTree.
this.getCliques = function getCliques()
Get the conflict measure of the data inserted in this JunctionTree.
this.getConflict = function getConflict()
Get the root Clique of this JunctionTree.
this.getRoot = function getRoot()
Get the total number of CG table entries for this JunctionTree.
this.getTotalCGSize = function getTotalCGSize()
Get the total number of discrete table configurations for this JunctionTree.
this.getTotalSize = function getTotalSize()
Tests if likelihoods have been propagated in this JunctionTree.
this.likelihoodIsPropagated = function likelihoodIsPropagated()
Tests if this JunctionTree contains updated tables that have not been propagated.
this.tablesToPropagate = function tablesToPropagate()
Propagates evidence in this JunctionTree.
this.propagate = function propagate( equilibrium, evidenceMode )
Get the HAPI object that owns this DataSet
this.getHAPI = function getHAPI()
Deletes this DataSet.
this.deleteObject = function deleteObject()
Deletes the specified column from this DataSet.
this.deleteColumn = function deleteColumn( column )
Deletes the specified row from this DataSet.
this.deleteRow = function deleteRow( row )
Returns the name of the specified column of this DataSet.
this.getColumnName = function getColumnName( column )
Returns the data item at the specified location of this DataSet.
this.getDataItem = function getDataItem( row, column )
Returns the number of columns in this DataSet.
this.getNumberOfColumns = function getNumberOfColumns()
Returns the number of rows in this DataSet.
this.getNumberOfRows = function getNumberOfRows()
Moves the specified column to a new position.
this.moveColumn = function moveColumn( column, newColumn )
Moves the specified row to a new position.
this.moveRow = function moveRow( row, newRow )
Creates a new column in this DataSet.
this.newColumn = function newColumn( name )
Creates a new row in this DataSet.
this.newRow = function newRow()
Sets the name of the specified column of this DataSet.
this.setColumnName = function setColumnName( column, name )
Sets (or deletes) the data item at the specified location of this DataSet.
this.setDataItem = function setDataItem( row, column, data )
Submits this DataSet in the form of a CSV file to the service located at a target URL.
this.save = function save( url, method, delimiter )
Generate an URL for downloading this DataSet as a CSV file
this.download = function download( delimiter, filename )