Author Topic: distribution parameters  (Read 20619 times)

Offline joost

  • Newbie
  • *
  • Posts: 7
    • View Profile
distribution parameters
« on: June 08, 2007, 14:03:19 »
Since assessing (posterior) distribution parameters (such as mean and standard deviation) depends very much on the choice of discretization (intervals), I assume that there is no standard procedure (Hugin function call) for doing this.
Thus, assumingly, one has to export the values of the posterior probabilities that are found (these values  can be seen in the graphs in the "Recompile" mode). 
How can I export these values, for example to xls or Mathematica? What is the most convenient way to compute the distribution parameters?

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Re: distribution parameters
« Reply #1 on: June 12, 2007, 09:09:51 »
The HUGIN software does not have functionality for automatic discretization of nodes. This would be a nice feature to have, but it has not yet been implemented.

The most efficient way for setting the intervals of a node and subsequently reading the posterior distribution over the intervals would be to write a small program for this using one of our APIs. For instance, you may use the ActiveX server to implement a macro using Visual Basic.

Given a network the steps to read the posterior probability distribution in a program are:
1) load the network
2) compile the network
3) enter evidence
4) propagate evidence
5) read the posterior beliefs of the node under consideration.

A simple visual basic macro implementing these steps may look something like this.

Sub asia()
Dim dom As Domain
Dim L, D As Node
Dim p As Double

' load the network
Set dom = LoadDomainFromNet("c:\asia.net", Nothing, 0)

' compile the network
dom.Compile

Set L = dom.GetNodeByName("L")
Set D = dom.GetNodeByName("D")

' enter evidence by selecting a state (alternatively you may load a case file)
D.SelectState (0)

' propagate evidence
Call dom.Propagate(hEquilibriumSum, hModeNormal)

' show beliefs
p = L.Belief(0)
Sheet1.Cells.Item(2, 1) = "P(L=yes|D=yes)"
Sheet1.Cells.Item(2, 2) = p

' end
End Sub

This macro loads the Asia model. You will need to adjust the macro to load the appropriate model, enter appropriate evidence and access the appropriate interval node.
HUGIN EXPERT A/S

Offline Anders L Madsen

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 2295
    • View Profile
Re: distribution parameters
« Reply #2 on: June 12, 2007, 09:16:11 »
By the way, you may force the posterior beliefs to be written to the Network Log using "View->Report Beliefs".
HUGIN EXPERT A/S

Offline Gary

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: distribution parameters
« Reply #3 on: June 13, 2007, 10:43:32 »
Joost,

I have lots of code for performing tasks with the Hugin beliefs (including a direct route to MS Excel using typical office automation techniques). I am sure we can share this.

However your observation about the sensitivity of posterior marginal parameters, like the mean or the sd, with respect to the discretization is interesting. Optimization of the discretization is tricky not least because the appropriate measure for optimization is not always clear - sensitivity of the posterior moments to the discretization is one such measure (the devil is in the tail!).

Strictly within the 'discretized' networks the individual state probabilities could be considered as parameters and it is then easier to measure the sensitivity of one posterior state probability (parameter) with respect to the probability of an input state. This scheme is a lot easier to implement but not necessarily as easy to interpret for real world problems.

Gary