Knowledge#
- class causalbase.search.Knowledge(required=frozenset({}), forbidden=frozenset({}))[source]#
Adjacencies fixed in advance, by domain knowledge or by design.
Both kinds constrain whether two variables are adjacent, not the direction of the edge between them: a search over equivalence classes decides directions from the data, and a required edge keeps whichever direction the data favour.
- Attributes:
- requiredfrozenset of frozenset of int
Pairs that are always adjacent.
- forbiddenfrozenset of frozenset of int
Pairs that are never adjacent.
- classmethod from_pairs(required=(), forbidden=(), names=())[source]#
Build knowledge from pairs of variable names or column indices.
- Parameters:
- required, forbiddeniterable of pairs
Pairs of names in names or of column indices into it.
- namessequence of str
The variables, in column order.
- Raises:
- ValueError
If a name is unknown, an index is not a column of names, a pair joins a variable to itself, or a pair is both required and forbidden.