forum.hugin.com
User Forums => HUGIN GUI Discussion => Topic started by: mortenaagaard on February 20, 2011, 13:48:14

Hi Hugin folks,
I do believe my IQ is ok, at least average.
Nevertheless I cannot figure out writing one expresssion with or without the expression builder!
Can you submit 510 examples of expressions can is syntactically correct and returns valuable results.
The example used could be one of the often used: ABC or the car does not start. Or what ever.
Thanks in advance.
Morten Aagaard

Dear Morten
Please refer to the 'Table Generator Tutorial' in the HUGIN GUI Help pages for a good introduction to the expressions, distributions and operators (Open the Hugin Help pages and browse Tutorials > Table Generator).
Attached is a few simple expression examples using discrete nodes, arithemetic operator (+) and ifthenelse:
Example 1
Three numbered nodes C1, C2 and C3. C3 has parents C1 and C2.
C1 has some distribution over state values 1 and 2
C2 has some distribution over state values 10 and 20
We wish to represent C1 and C2 as a single node C3. For C3 to represent the combined distribution of C1 + C2 it has four state values:
11: representing C1=1, C2=10
12: representing C1=2, C2=10
21: representing C1=1, C2=20
22: representing C1=2, C2=20
Instead of manually specifying P(C3=11C1=1,C2=10)=1, P(C3=11C1=2,C2=10)=0 etc. etc. for C3  we specify the expression 'C1 + C2' and the table is automatically generated.
Example 2
One boolean node C4, three nodes C5, C6, C7 with identical states. P(C5) and P(C6) differ. C7 has C46 as parents.
We want the distribution for C7 to be that of C5 or C6, depending on the state of C4.
Instead of manually specifying P(C7="state 1"C4=true,C5="state 1",C6="state 2)=1, P(C7="state 1"C4=false,C5="state 1",C6="state 2)=0 etc. etc. for C7  we specify the expression 'if (C4 == true, C5, C6)' and the table is automatically generated.

Thanks, Martin.
The example have been enlightning. I missed at first that the variables of example 1 should be type "numbered".
Thanks.
Morten