Author Topic: Expressionbuilder#&%###!!!! simple question  (Read 7832 times)

Offline mortenaagaard

  • Newbie
  • *
  • Posts: 6
    • View Profile
Expressionbuilder#&%###!!!! simple question
« 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 5-10 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

Offline Martin

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 613
    • View Profile
Re: Expressionbuilder#&%###!!!! simple question
« Reply #1 on: February 22, 2011, 12:16:13 »
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 if-then-else:

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=11|C1=1,C2=10)=1, P(C3=11|C1=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 C4-6 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.
Hugin Expert A/S

Offline mortenaagaard

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Expressionbuilder#&%###!!!! simple question
« Reply #2 on: February 24, 2011, 13:00:45 »
Thanks, Martin.
The example have been enlightning. I missed at first that the variables of example 1 should be type "numbered".

Thanks.

Morten