Skip to Content

Constants

Work in Progress

Context

Constants are named values stored in a network. To change one, several, or all of them at once, associate a text dictionary with the network. Each entry specifies a Constant’s name, type, and new value. Constants omitted from the dictionary keep their current values.

Example

Inspect the Current Values

The example network contains 12 Constants. Choose Menus > Edit > Edit Constants to see their starting values in the Constant Editor. For example, Range Limit\mathit{Range\ Limit} is 4.0 and Sample Count\mathit{Sample\ Count} is 50.

Calibration Constants.xbl
XBL
Constant Editor before association, with all 12 starting values, including Range Limit at 4.0 and Sample Count at 50

Associate the Constants Dictionary

To update five Constants together, put their new values in a plain text file, one entry per line. A backslash preserves a space in a Constant’s name. Here is the file used in this example.

Alarm\ Level=REAL 4.8 Calibration\ Offset=REAL 0.15 Range\ Limit=REAL 5.0 Sample\ Count=INTEGER 100 Upper\ Warning\ Level=REAL 4.5
Updated Constants.txt
TXT

Choose Menus > Data > Associate Dictionary > Node > Constants. In Select the Dictionary File, select Updated Constants.txt and click Open. If BayesiaLab asks to recompute a table, choose Yes to apply the new value to the Formula that uses it.

Select the Dictionary File dialog with Updated Constants.txt selected and the Open button enabled

Verify the New Values

Reopen the Constant Editor to compare the values with the original list. Range Limit\mathit{Range\ Limit} is now 5.0 and Sample Count\mathit{Sample\ Count} is 100. Gain\mathit{Gain} was omitted from the dictionary and is still 1.0.

Constant Editor after association, with the five updated values and the other seven Constants at their original values

When a Formula Uses a Changed Constant

In the Formula Editor for N1\mathit{N1}, Uniform(?N1?, 1, ?Range Limit?) uses Range Limit\mathit{Range\ Limit} as the upper bound of the distribution.

Formula tab of the Node Editor for N1, showing Range Limit in the Uniform formula and selected in the list of Constants

When you open the dictionary file, BayesiaLab detects that the Formula uses a changed Constant and asks whether to recompute the node’s conditional probability table. Choose Yes to update the table using the new upper bound of 5.0.

BayesiaLab asks whether to recompute the affected node’s table, with No and Yes buttons