mbi.MarkovRandomField
- class mbi.MarkovRandomField(potentials: CliqueVector, marginals: CliqueVector, total: Array | ndarray | bool | number | float | int = 1)[source]
Bases:
MappingRepresents 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:
- marginals
A CliqueVector containing the marginal distributions for a set of cliques, derived from the potentials.
- Type:
- 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__getGenerates synthetic data based on the learned model's marginals.
Attributes
Returns the list of cliques the model's potentials are defined over.
Returns the Domain object associated with this graphical model.
- potentials: CliqueVector
- marginals: CliqueVector
- total: Array | ndarray | bool | number | float | int = 1
- 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