mbi.Constraint

class mbi.Constraint(domain: Domain, valid: ndarray | None = None, invalid: ndarray | None = None, mapping: ndarray | None = None)[source]

Bases: object

A structural constraint on allowed value combinations.

Exactly one of valid, invalid, or mapping must be specified.

domain

The sub-domain this constraint covers.

Type:

mbi.domain.Domain

valid

Array of shape (n, len(domain)) listing allowed combos.

Type:

numpy.ndarray | None

invalid

Array of shape (n, len(domain)) listing forbidden combos.

Type:

numpy.ndarray | None

mapping

Array of shape (domain.shape[0],) defining a functional dependency from the first attribute (fine) to the second (coarse). Requires exactly two attributes in the domain.

Type:

numpy.ndarray | None

Methods

__init__

Attributes

clique

Sorted attribute names, for junction tree construction.

invalid

is_deterministic

Whether this constraint is a functional dependency.

mapping

potential

0 for allowed, -inf for forbidden.

valid

domain

domain: Domain
valid: ndarray | None = None
invalid: ndarray | None = None
mapping: ndarray | None = None
property clique: tuple[str | int, ...]

Sorted attribute names, for junction tree construction.

property is_deterministic: bool

Whether this constraint is a functional dependency.

property potential: Factor

0 for allowed, -inf for forbidden.

Type:

Return a log-space potential