BayesNet.loadGUM
- BayesNet.loadGUM(name, l=None, binary=None)
Load a jgum (JSON) or bgum (binary/msgpack) file.
- Parameters:
name (
str) – the file’s path (extension:.jgumfor JSON,.bgumfor binary)binary (
bool, optional) – True to read a bgum (msgpack) file, False to read a jgum (JSON) file. By default, the format is given by the extension (binary for an unknown extension).
- Raises:
pyagrum.InvalidArgument – If binary contradicts the extension (
.jgumor.bgum)pyagrum.GumIOError – If file not found
pyagrum.FatalError – If file content is not valid
- Return type:
None
See also
- JGUM / BGUM Format Reference
complete format reference
- Parameters:
l (
object)
Example
import pyagrum as gum
bn = gum.fastBN("A->B->C")
bn.saveGUM("model.bgum")
bn2 = gum.BayesNet()
bn2.loadGUM("model.bgum")
sorted(bn2.names())
# ['A', 'B', 'C']
bn2.hasSameStructure(bn)
# True
Class