YAML representationΒΆ

When symfer serializes factor expressions from Python memory to a file, it uses the YAML format. YAML is like JSON, only:

  • You’re allowed to leave out some of the brackets, braces and quotes.
  • More importantly, you can define shared sub-structures within your document by placing an anchor such as &f at the first occurence, and a link *f at subsequent occurrences.
  • An object can be preceded by a !tag defining its type.

The translation is as follows.

Python constructor YAML
SumProd(['A','B'],[f,g])
!sumprod
arg: [A,B]
fac: [*f,*g]
f = Multinom([{'A':[0,1]},..],
             [0.25,0.75,..])
&f !multinom
dom: [A: [0,0],..]
par: [0.25,0.75,..]
d = Fun([{'C':[False,True]}],
        [{'A':[0,1],..],
        [1,0,..])
&d !fun
cod: [C: [False,True]]
dom: [A: [0,1],..]
par: [1,0,..]
Index([d],[h])
!index
det: [*d]
fac: [*h]
I()
!i {}
Embed([d])
!embed
det: [*d]
Reorder([{'newB':'B'},
         {'newA':'A'}],
        [f])
!reorder
dic: [newB: B, newA: A]
fac: [*f]

Table Of Contents

Previous topic

Evaluation options

This Page