BIFReader#

class pgmpy.readwrite.BIFReader(path=None, string=None, include_properties=False)[source]#

Bases: object

Initializes a BIFReader object.

Parameters:
pathfile or str

File of bif data

stringstr

String of bif data

include_properties: boolean

If True, gets the properties tag from the file and stores in graph properties.

Examples

>>> # dog-problem.bif file is present at
>>> # http://www.cs.cmu.edu/~javabayes/Examples/DogProblem/dog-problem.bif
>>> from pgmpy.readwrite import BIFReader
>>> reader = BIFReader("bif_test.bif")
<pgmpy.readwrite.BIF.BIFReader object at 0x7f2375621cf8>
>>> 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.

get_probability_grammar()[source]#

A method that returns probability grammar

get_variable_grammar()[source]#

A method that returns variable grammar