MarkovRandomField.loadGUM
- MarkovRandomField.loadGUM(name, 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
Example
import pyagrum as gum
mrf = gum.fastMRF("A--B;B--C")
mrf.saveGUM("model.jgum")
mrf2 = gum.MarkovRandomField()
mrf2.loadGUM("model.jgum")
mrf2.hasSameStructure(mrf)
# True
Class