mbdlyb.formalisms.base ====================== .. py:module:: mbdlyb.formalisms.base .. autoapi-nested-parse:: Base classes for formalism-specific node types in MBD models. Provides CPTEnabledNode and related functionality for formalisms that use Conditional Probability Tables (CPT) for representing dependencies. Classes ------- .. autoapisummary:: mbdlyb.formalisms.base.CPTEnabledNode Module Contents --------------- .. py:class:: CPTEnabledNode[T](name: str, states: list[T], net: MBDNet) Bases: :py:obj:`mbdlyb.MBDNode`\ [\ :py:obj:`T`\ ] Node that supports Conditional Probability Table (CPT) representation. CPTEnabledNode extends MBDNode to support representation via CPTs, which explicitly enumerate probabilities for all combinations of parent states. This is used in Bayesian networks and similar formalisms. :ivar _PARENT_RELATION_TYPE: The dependency type to consider as parents. :vartype _PARENT_RELATION_TYPE: Type[MBDDependency] :ivar _param_value_mapping_fn: Functions to map state values for parameters. :vartype _param_value_mapping_fn: dict[Type[MBDNode], Callable] :ivar _cpt_parents: Override for the parent nodes used in CPT. :vartype _cpt_parents: Optional[list[MBDNode]] :ivar cpt: The cached conditional probability table array. :vartype cpt: Optional[np.ndarray] .. py:attribute:: cpt :type: Optional[numpy.ndarray] :value: None .. py:property:: cpt_parents :type: list[mbdlyb.MBDNode] Get the parent nodes used for CPT computation. Returns either the explicitly set parents or the source nodes of parent relations matching the parent relation type. :returns: List of parent nodes. :rtype: list[MBDNode] .. py:property:: has_cpt :type: bool Check if this node has a CPT defined. :returns: True if the cpt array is not None. :rtype: bool