Discrete Variables with State Values

Netica

Discrete Variables with State Values

When a node equation contains a = 4 && typeof(BSPSPopupOnMouseOver) == 'function') BSPSPopupOnMouseOver(event);" class="BSSCPopup" onclick="BSSCPopup('X_PU_discrete.htm');return false;">discrete variable which has = 4 && typeof(BSPSPopupOnMouseOver) == 'function') BSPSPopupOnMouseOver(event);" class="BSSCPopup" onclick="BSSCPopup('X_PU_state_value.htm');return false;">state values defined, the numeric quantities which that variable supplies to the equation could be the state indexes of the variable, or the values associated with the state indexes.  Usually a function or operator will assume it is the values that are desired, but in a few cases it will use the state indexes, for instance if the other arguments to it are state indexes.

For example, consider the equality operator, and a discrete variable Color, which has values and state names (such as blue) defined.  When Color appears in the equation, it could refer to a state index of Color, or to the value associated with that state index.

Uses state index:  Color == blue      Color == #1      #Color1 == #Color2

 

Uses state value:  Color == 3.2       Color ==  1      Color1 == Color2

 

The above is for the evaluation of equation expressions.  When it comes to assigning the result of the equation to its LHS (left-hand side) variable, if the variable is discrete with values defined, the same issue arises.  Has the equation calculated a state index for the variable, or a value associated with the state?  The purpose of the AsState function is to indicate that state indexes should be used.

Continuing with the example above:

Assigns by value:  Color() = 3       Color1 (Color2) = Color2

 

Assigns by index:  Color() = #3      Color1 (Color2) = AsState (Color2)

 

                                     Color1 (X, Y) = AsState (integer (X / Y))

You may want to verify that Netica is doing as you expect by having it calculate a few values and checking (for example, by using Table Equation to Table).  Or you can examine the internal representation of the equation by choosing Report Horizontal Format from the menu and then Report Equation.  Check for places where Netica has inserted the function "_levels" (maps state index real value), "_find0" (maps real value state index of a discrete variable), or "_discretize" (maps real value state index of a continuous variable).