NETReader#
- class pgmpy.readwrite.NETReader(path=None, string=None, include_properties=False, defaultName='bn_model')[source]#
Bases:
objectInitializes a NETReader object.
- Parameters:
- pathfile or str
File of net data
- stringstr
String of net data
- include_properties: boolean
If True, gets the properties tag from the file and stores in graph properties.
- defaultname: int (default: “bn_model”)
Default name for the network if a network name is not available in the net file.
Examples
# asia.net file is present at # https://www.bnlearn.com/bnrepository/discrete-small.html#asia >>> from pgmpy.readwrite import NETReader >>> reader = NETReader(“asia.net”) >>> reader <pgmpy.readwrite.NET.NETReader at 0x7feac645c640> >>> model = reader.get_model()
- get_model(state_name_type=<class 'str'>)[source]#
Returns the Bayesian Model read from the file/str.
- Parameters:
- state_name_type: int, str or bool (default: str)
The data type to which to convert the state names of the variables.