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: .jgum for JSON, .bgum for 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:
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

BayesNet