I am following the PDF version of the tutorial for SMILE wrappers, specifically for the Python language.
In Tutorial 1, after adding arcs, it redirected to a tutorial "Multidimensional arrays". In this section, how to understand the following statement? It says " The order of the coordinates reflects the order in which the arcs to the node were created. The most significant (leftmost) coordinate will represent the state of the first parent. The state of the node itself corresponds to the least significant (rightmost) coordinate."
In Tutorial 1, the arcs are added in this order:
Code: Select all
net.add_arc(e, s)
net.add_arc(s, f)
net.add_arc("Economy", "Forecast")
Code: Select all
forecastDef = [
0.70, # P(Forecast=G|Success=S,Economy=U)
0.29, # P(Forecast=M|Success=S,Economy=U)
0.01, # P(Forecast=P|Success=S,Economy=U)
0.65, # P(Forecast=G|Success=S,Economy=F)
0.30, # P(Forecast=M|Success=S,Economy=F)
0.05, # P(Forecast=P|Success=S,Economy=F)
0.60, # P(Forecast=G|Success=S,Economy=D)
0.30, # P(Forecast=M|Success=S,Economy=D)
0.10, # P(Forecast=P|Success=S,Economy=D)
0.15, # P(Forecast=G|Success=F,Economy=U)
0.30, # P(Forecast=M|Success=F,Economy=U)
0.55, # P(Forecast=P|Success=F,Economy=U)
0.10, # P(Forecast=G|Success=F,Economy=F)
0.30, # P(Forecast=M|Success=F,Economy=F)
0.60, # P(Forecast=P|Success=F,Economy=F)
0.05, # P(Forecast=G|Success=F,Economy=D)
0.25, # P(Forecast=G|Success=F,Economy=D)
0.70 # P(Forecast=G|Success=F,Economy=D)
]
So for the "forecast" node, the first parent is s (success), the second parent is e (economy).
My understanding:
In the Python code, we can see that the order of numbers in the flat array can be see as:
We have three nested for loops,
The first parent "success" is in the first for loop, the second parent "economy" is in the second for loop, the node "forecast" is in the third for loop.
Code: Select all
for tmp_s in ["S", "F"]:
for tmp_e in ["U", "F", "D"]:
for tmp_f in ["G", "M", "P"]:
print("P(Forcast=%s|Success=%s,Economy=%s)" % (tmp_f, tmp_s, tmp_e))
What is the leftmost coordinate? What is the rightmost coordinate?