Constants Management
Context
Constants are very practical for managing values that are utilized in equations throughout the network.
For instance, Constants may represent a list of key assumptions pertaining to a problem domain. By virtue of having Constants stored centrally, you can easily modify values and, thus, apply them universally, wherever those values are used in equations in the network.
- In BayesiaLab, you can maintain values as Constants so they can be used in equations that generate probability distributions of nodes.
- A Constant must have a unique name.
- A Constant can be of types Boolean, Integer, Real, or String.
- In equations, Constants are referenced by their name.
- Constants exist in the "background" and are not shown as nodes in the network.
- As a result, Constants do not need to be connected to the nodes that utilize them. Rather, Constants can be accessed in any equation throughout the network merely by referencing the Constants' names.
- Constants can be created and modified in the Modeling Mode only.
- When switching from Modeling Mode into Validation Mode, the conditional probability tables of nodes that are defined by equations and Constants are recomputed according to the current values of those Constants.
- Once you have created a Constant, you can subsequently modify it at your discretion.
Constants Editor
All available operations on Constants are accessible in the Constants Editor:
-
Add
-
Edit
- Name
- Type
- Real
- Boolean
- Integer
- String
- Value
-
Remove
-
Import
-
Export
You can access the Constants Editor in three ways:
-
From the Main Menu, select
Edit > Edit Constants
-
Right-click on the background of the Graph Panel to bring up the Contextual Menu, then select
Edit Constants
-
Click the Constants indicator in the Status Bar
Example & Workflow Animation
The following example illustrates a Bayesian network that models profitability as a function of inventory and demand. For our purposes, we focus on the random node Demand. We will define its probability table of Demand with a Probabilistic Equation and Constants.
More specifically, we define the distribution of Demand as a Normal distribution with the mean Demand Forecast and the standard deviation Demand Forecast Uncertainty.
Demand=N(DemandForecast,DemandForecastUncertainty) The workflow shows the following steps:
- Right-click on the background of the Graph Panel to bring up the Contextual Menu, then select
Edit Constants
- In the Constant Editor, click
Add
- Set
Name
,Type
, andValue
of the new Constant - Click
OK
to close the Constant Editor - Double-click the node Demand, which opens the Node Editor
- Open the
Probability Distribution > Equation
tab - Set
Equation Type
toProbabilistic
- From the
Continuous Probability Distributions
folder, double-click onNormal(x, m, s)
to add it as a function template to the Equation Editor - Double-click on
Demand
in the center panel to replace thex
placeholder - Double-click on
Constants
to show the available Constants in the right panel - Double-click
Demand Forecast
andDemand Forecast Uncertainty
to place them into them
ands
placeholders respectively - Click
Validate Equation
- Click
OK
to close the Equation Editor - Switch to Validation Mode
- Double-click the node Demand to bring up the corresponding Monitor to the Monitor Panel
- Review the distribution shown on the Monitor of Demand