SMILE Tutorial 5: Computing Value of Information

From DSL
Jump to: navigation, search

It is easy to compute value of information with SMILE. In our example, let us say that we want to compute how much we should pay our expert for his forecast about the market evolution.

Load the network:

  DSL_network theNet;
  theNet.ReadFile("tutorial.dsl");

The class DSL_valueOfInformation is provided to allow easy specification of the nodes we are interested in. Let us declare an instance of this class and link it to the current network. The class will perform some checking internally to make sure the query makes sense.

  DSL_valueOfInformation theValue(&theNet);

We want to know what is the value of information of node Forecast with respect of node Invest. In other words, we want to know how valuable is it for us to know the value of the node Forecast before we make our decision. For this calculation we will need to fill this data into the DSL_valueOfInformation class:

  int forecast = theNet.FindNode("Forecast");
  int invest = theNet.FindNode("Invest");

We will use the function AddNode to specify all the nodes we want to compute the value of information of. You can add as many as you want by calling this function once for each node. However, it is important to note that, if several nodes are specified, the value of information computed will be the value of knowing all the nodes at the same time. If you want to know the value of information of individual nodes, you will have to repeat the procedure shown in this tutorial once for each node.

  theValue.AddNode(forecast);

Since we want to know the value of knowing Forecast before we decide about node Invest, we will use the function SetDecision to establish Invest as the decision node:

  theValue.SetDecision(invest);

Now the only thing left is to compute the value of information:

  theNet.ValueOfInformation(theValue);

The results will have a similar structure to that of the value of a value node that was shown in Tutorial 4. Our example is an easy case because we only have one decision in the model so we will only have one number as a result:

  DSL_Dmatrix &theResult = theValue.GetValues();
  double EVIForecast = theResult[0];
  printf("Expected Value of Information(\"Forecast\") = %f\n",EVIForecast);
  theNet.WriteFile("tutorial.dsl");

In general, however, we can have several decision nodes. In this case, the value of information of a node C with respect to a decision node D will be indexed by all the temporal predecessors of that decision D (a temporal predecessor is a decision node that precedes node D in time and also all the informational predecessors of those decision nodes and node D). If this is the case, we will have to use the function GetIndexingNodes to find out which are the indexes of the resulting matrix.

Personal tools