I'm just starting to learn pyAgrum. I am looking for functions to both plot a network and print the tables/potentials within a python session. I.e., I'm looking to do this without the need for any sort of HTML-based interpreter (pylab, etc.). I'm coming from the R-world, where I'm used to this kind of workflow using R's version of igraph e.g., and where tables can be printed as ordinary R-arrays. I know, that pyAgrum::Potential's are lower-level C++ classes but is there a way to achieve the above? I like to stay in my editor :)
I already answered you somewhere else :-) but for the sake of the other readers :
to print an ascii version of a table, you can just use the __str__()
methods. Hence print(p)
where p
is a Potential will do the job.
to export an image of a BN, you can use pyAgrum.lib.image :
import pyAgrum
import pyAgrum.lib.image as gimg
bn=gum.fastBN("A->B->C")
gimg.export(bn,"test.pdf")
gimg.exportInference(bn,"test.png",evs={"A":1})
will export test.pdf
containing the graph and test.png
containing the (graphical) result of an inference.