mbi.MarkovRandomField

class mbi.MarkovRandomField(potentials: CliqueVector, marginals: CliqueVector, total: Array | ndarray | bool | number | float | int = 1)[source]

Bases: Mapping

Represents a learned graphical model.

This class encapsulates the components of a Markov Random Field that has been learned from data. It stores the learned potentials, the resulting marginal distributions over specified cliques, and the total count (e.g., number of records or equivalent sample size) associated with the model.

potentials

A CliqueVector containing the learned potential functions for the cliques in the model.

Type:

CliqueVector

marginals

A CliqueVector containing the marginal distributions for a set of cliques, derived from the potentials.

Type:

CliqueVector

total

The total count or effective sample size represented by the model. This is often used for scaling or interpreting the marginals.

Type:

chex.Numeric

Methods

__init__

from_tuple

get

items

keys

project

replace

supports

synthetic_data

Generates synthetic data based on the learned model's marginals.

to_tuple

values

Attributes

cliques

Returns the list of cliques the model's potentials are defined over.

domain

Returns the Domain object associated with this graphical model.

total

potentials

marginals

potentials: CliqueVector
marginals: CliqueVector
total: Array | ndarray | bool | number | float | int = 1
project(attrs: str | Sequence[str]) Factor[source]
supports(attrs: str | Sequence[str]) bool[source]
synthetic_data(rows: int | None = None, method: str = 'round') Dataset[source]

Generates synthetic data based on the learned model’s marginals.

Parameters:
  • rows – The number of rows to generate. If not provided, uses the model total, which is usually estimated automatically.

  • method – Specification for strategy to use to generate records. - “round” for randomized rounding - “sample” for i.i.d sampling

Returns:

A synthetic dataset whose marginals should closely match those of the model.

property domain

Returns the Domain object associated with this graphical model.

property cliques

Returns the list of cliques the model’s potentials are defined over.

from_tuple()
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
replace(**kwargs)
to_tuple()
values() an object providing a view on D's values