inferlo.datasets.UaiReader

class inferlo.datasets.UaiReader[source]

Reads files in UAI format.

__init__()[source]

Methods

__init__()

read_marginals(path)

Reads true marginals form a file in UAI format.

read_model(path)

Reads Graphical model form a file in UAI format.

read_marginals(path) array[source]

Reads true marginals form a file in UAI format.

Format description: http://www.hlt.utdallas.edu/~vgogate/uai14-competition/resformat.html

Parameters:

path – Local path to text file with true marginals in UAI format.

Returns:

2D numpy array. First dimension is number of variables, second is maximal domain size of a variable. result[i][j] is a probability that i-th variable takes j-th value (or 0 if this variable’s domain size is less than j+1).

read_model(path) GenericGraphModel[source]

Reads Graphical model form a file in UAI format.

Format description: http://www.hlt.utdallas.edu/~vgogate/uai14-competition/modelformat.html

Parameters:

path – Local path to text file with GM in UAI format.

Returns:

Graphical model read from the file.