Meta-Inference

(TBD: Under construction) (This is advanced reference that is beyond the scope of the user guide)

Introduction

Meta-Inference refers to logic in your model that reasons about (or manipulates) the model itself. For example, an expression that identifies all Chance-node ancestors of variable X is performing meta-inference.

Meta-inference is an advanced topic, appropriate only for the more experienced Analytica modelers. However, the ability to create meta-inferential algorithms opens many doors for expanding the capabilities of Analytica itself. For example, in the past, users of Analytica implemented meta-inferential algorithms including the following:

  • Providing an advanced "Find object" form, that locates objects matching rich search criteria.
  • Changing the colors or sizes of nodes in influence diagrams to reflect the results of sensitivity analyses.
  • Changing the colors of nodes to reflect a special color scheme.
  • Implementing specialized forms of sensitivity analyses.
  • Running stochastic simulations in batches, so that huge models or huge sample sizes can be utilized within the constraints of available memory.
  • Collecting time/memory profiling information after demanding computations.

Other examples of potential meta-inferential algorithms could also include:

  • Triangulation and propagation algorithms to compute discrete posterior probabilities in Markov field models such as Bayesian networks.
  • Algorithms to automatically re-arrange (layout) variables in an influence diagram.

Objects and Handles

Meta-inference involves reasoning about Analytica objects, including the various nodes that appear on diagrams (Variables, indexes, buttons, etc), and the attributes that constitute the properties of those objects. The fundamental unit of representation is a handle to an object, which we refer to as a handle (or varTerm).

While there is at most one instantiation of any given object, there may be any number of handles that refer to that object. There are many ways in which you might obtain a handle to an object from an Analytica expression. The most straightforward is by using the Handle function. If Va1 is the identifier of an object, then

Handle(Va1)

returns a handle to that object. This handle unambiguously refers to that particular object. Below several other methods for obtaining handles are identified. You can also obtain a handle for a global object using the HandleFromIdentifier function.

Lists and Indexes of Handles

Often, meta-inference algorithms manipulate lists of handles, or utilize indexes where the index elements are handles.

A global index can be defined as a list of identifiers. You can do this by selecting "List" from the definition type pulldown, and entering identifers of existing objects as the elements of the index. When you do this, the IndexValue of the index consists of handles to objects. If you define Index In1 in this fashion and evaluate IndexValue(In1), you will obtain a list of handles. Each of the element objects will be evaluated when your index is evaluated, so these must be well-defined variables.

A local index can be defined as a list of handles using the MetaIndex..Do construct. For example, the following defines an index, I, as the objects contained in Module Mo1, and computes an array based on this index containing all the descriptions of those objects:

MetaIndex I := Contains of Mo1;
Description of I

When you are performing meta-inference, you should generally use MetaIndex..Do rather than Index..Do. While both can be used, they differ in how the local index behaves when used in a Subscript operation. MetaIndex..Do can be used without the elements being evaluated, and hence is what is generally desired.

The Display of Handles

When a Handle is displayed in a result table, its title is shown in the table cell, unless Show By Identifiers is on, in which case its identifier is displayed. Show by identifier is toggled via the Object menu, or by pressing CTRL-Y.

If you double click on a cell containing a handle, Analytica jumps to the object window for that object.

Treatment of Handles in Local variables

When a local variable (defined using Var..Do, For..Do, or declared as a function parameter as Variable or Variable) is assigned a single handle, it becomes an alias to the object pointed to by the handle. When the local variable appears in an expression, it is equivalent to writing the original object identifier. So, for example, the following two expressions are exactly equivalent:

Var x := Handle(Va1) Do x^2
Va1^2

Notice that x does not evaluate to a handle to Va1, it actually serves as an alias of Va1. This is an important subtlety that must be mastered in order to manipulate handles. A local variable is treated differently when it contains a single handle than it is otherwise. This can be quite convenient, since normally when you get to the level of a single handle, you will usually access or manipulate that object in some way, but you must realize that the local evaluates to the object's value, not to a handle to the object. If you really want the handle to the object, use Handle(x).

This subtlety does have some ramifications. For example, if no element of array A contains a handle, then the following expression copies the value of A:

For x := A do x

However, if an element of A is a handle, then the value of the object will be substituted for that element when the above is executed. This could increase the dimensionality of the result. To make a true copy, where handles remain handles, you would need to use:

For x := A do 
  if TypeOf(x,shallow:true)="Object" Then Handle(x) Else x

Evaluation

Subscripting

Accessing attributes

Notable attributes

Contains, IsIn, Outputs, Inputs, DisplayOutputs, DisplayInputs, Identifier, Class, nodeSize, nodeLocation, nodeColor, nodeFontColor.

Manipulating Local Indexes

IndexesOf.

Parameters and Local Variables holding varTerms

Assignment

Looping over Handles

See Also

Comments


You are not allowed to post comments.