mbdlyb.formalisms.bayesnet.io
Input/Output utilities for Bayesian networks.
This module provides functions to export Bayesian networks to standard formats: - BIF XML format for cross-platform compatibility - Netica format for use with the Netica software
- Functions:
export_to_bifxml: Export a Bayesian network to BIF XML format. export_to_netica: Export a Bayesian network to Netica format.
Functions
|
Export a Bayesian network to BIF XML format. |
|
Export a Bayesian network to Netica format. |
Module Contents
- mbdlyb.formalisms.bayesnet.io.export_to_bifxml(net: mbdlyb.formalisms.bayesnet.base.BayesNet, path: pathlib.Path | str, overwrite: bool = False)
Export a Bayesian network to BIF XML format.
Converts the abstract Bayesian network to pyAgrum format and saves it as a BIF (Bayesian Interchange Format) XML file.
- Parameters:
net – The BayesNet instance to export.
path – The file path where the BIF XML file will be saved. If a string without an extension is provided, ‘.bifxml’ is appended.
overwrite – If False, raises FileExistsError if the file already exists. If True, overwrites existing files. Defaults to False.
- Raises:
FileExistsError – If the file exists and overwrite is False.
- mbdlyb.formalisms.bayesnet.io.export_to_netica(net: mbdlyb.formalisms.bayesnet.base.BayesNet, path: pathlib.Path | str, colormap: mbdlyb.colormap.ColorMap | None = None, overwrite: bool = False)
Export a Bayesian network to Netica format.
Converts the abstract Bayesian network to Netica format (.dne file) suitable for use with the Netica software. Includes automatic node layout and optional color-coding of node types.
- Parameters:
net – The BayesNet instance to export.
path – The file path where the Netica file will be saved. If a string without an extension is provided, ‘.dne’ is appended.
colormap – Optional ColorMap instance for coloring node types. If None, a default ColorMap is created. Defaults to None.
overwrite – If False, raises FileExistsError if the file already exists. If True, overwrites existing files. Defaults to False.
- Raises:
FileExistsError – If the file exists and overwrite is False.