class FlipSequence {
subparts Flip[10];
}
class Flip {
Side Heads 0.0, Tails 0.0;
}
There must be a declaration for every class, even if the class is empty. However, if no information is known about a class (or object), the lines in the declaration can be omitted (i.e., you do not have to leave empty ';' lines).
The .db file will only contain the name of the Top Object (i.e, the singular object that is of the Top Class):
FlipSequence Coin {
}
We can perform probabilistic inference to result in a uniform distribution:
al -i uniform_coin.tml -o uniform_coin.result -e coin.db -q Side(Flip)
(Note: Quotation marks may be required around the query on your system due to the parentheses.) The query asks what is the probability of each possible value of Side is for each Flip object in the knowledge base.
The resulting file uniform.result shows the marginals
given no other evidence:
P[Side(Coin.Flip[1],Heads)] = 0.500000
P[Side(Coin.Flip[1],Tails)] = 0.500000
P[Side(Coin.Flip[2],Heads)] = 0.500000
P[Side(Coin.Flip[2],Tails)] = 0.500000
P[Side(Coin.Flip[3],Heads)] = 0.500000
P[Side(Coin.Flip[3],Tails)] = 0.500000
P[Side(Coin.Flip[4],Heads)] = 0.500000
P[Side(Coin.Flip[4],Tails)] = 0.500000
P[Side(Coin.Flip[5],Heads)] = 0.500000
P[Side(Coin.Flip[5],Tails)] = 0.500000
...
The command
al -i uniform.mln -o uniform.result -e uniform.db -q Side(Flip,Heads)will find the marginal probability of Heads for each Flip object: