Module ImportFrom alias ImportFrom alias Import alias identifier Import alias identifier ImportFrom alias ImportFrom alias alias ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr TupleLoad NameLoad Num NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad Call NameLoad ListComp NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults kwarg body Expr Str TryExcept body If BoolOpOr CompareNotEq Call NameLoad NameLoad Num CompareNotEq Call NameLoad NameLoad Num body Raise Call NameLoad Str orelse If BoolOpOr UnaryOpNot Call NameLoad SubscriptLoad NameLoad Index Num NameLoad UnaryOpNot Call NameLoad SubscriptLoad NameLoad Index Num NameLoad body Raise Call NameLoad Str orelse If CompareEq SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body Assign NameStore TupleLoad SubscriptLoad NameLoad Index Num Num Assign NameStore TupleLoad SubscriptLoad NameLoad Index Num Num orelse If CompareEq SubscriptLoad NameLoad Index Num BinOpSub SubscriptLoad NameLoad Index Num Num body Assign NameStore TupleLoad SubscriptLoad NameLoad Index Num Num Assign NameStore TupleLoad SubscriptLoad NameLoad Index Num Num orelse If CompareGt SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body Raise Call NameLoad Str orelse If CompareNotEq SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body Raise Call NameLoad Str handlers ExceptHandler type NameLoad body Raise Call NameLoad Str If CompareEq NameLoad NameLoad body Raise Call NameLoad Str orelse If BoolOpAnd CompareIn NameLoad Call AttributeLoad Call NameLoad NameLoad NameLoad attr CompareIn NameLoad Call AttributeLoad Call NameLoad NameLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad body Raise Call NameLoad Call AttributeLoad Str attr keyword Call NameLoad NameLoad keyword Call NameLoad NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad NameLoad If CompareEq SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index Num BinOpSub Num SubscriptLoad NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num BinOpSub Num SubscriptLoad NameLoad Index Num orelse Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr TupleLoad SubscriptLoad NameLoad Index Num BinOpSub Num SubscriptLoad NameLoad Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str If BoolOpOr UnaryOpNot Call NameLoad NameLoad NameLoad CompareLt NameLoad Num body Raise Call NameLoad Str Return ListComp Call NameLoad GeneratorExp TupleLoad SubscriptLoad NameLoad Index Num NameLoad comprehension NameStore NameLoad comprehension NameStore Call AttributeLoad NameLoad attr CompareEqEq SubscriptLoad SubscriptLoad NameLoad Index Num Index Num SubscriptLoad SubscriptLoad NameLoad Index Num Index Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return ListComp NameLoad comprehension NameStore Call AttributeLoad NameLoad attr CompareNotEq SubscriptLoad SubscriptLoad NameLoad Index Num Index Num SubscriptLoad SubscriptLoad NameLoad Index Num Index Num decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str If BoolOpOr UnaryOpNot Call NameLoad NameLoad NameLoad CompareLt NameLoad Num body Raise Call NameLoad Str Return ListComp TupleLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num NameLoad comprehension NameStore Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults Num body Expr Str If BoolOpOr UnaryOpNot Call NameLoad NameLoad NameLoad CompareLt NameLoad Num body Raise Call NameLoad Str Return ListComp TupleLoad NameLoad NameLoad comprehension NameStore Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str For NameStore NameLoad body If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Str If BinOpSub Call NameLoad AttributeLoad NameLoad attr Call AttributeLoad Call NameLoad AttributeLoad NameLoad attr attr Call NameLoad Call AttributeLoad Call NameLoad NameLoad NameLoad attr body Raise Call NameLoad Str NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad Num body Expr Str If NameLoad body If CompareNotIn NameLoad Call AttributeLoad Call NameLoad NameLoad NameLoad attr body Raise Call NameLoad Str orelse For NameStore AttributeLoad NameLoad attr body If CompareEq AttributeLoad NameLoad attr NameLoad body Return NameLoad orelse Return ListComp NameLoad comprehension NameStore AttributeLoad NameLoad attr Call AttributeLoad Call NameLoad Call NameLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str For NameStore NameLoad body If Call NameLoad NameLoad TupleLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Num Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq Call NameLoad NameLoad Call NameLoad IfExp NameLoad NameLoad ListLoad body Raise Call NameLoad Call AttributeLoad Str attr keyword NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad Call AttributeLoad Call AttributeLoad NameLoad attr attr ListLoad NameLoad keyword NameLoad attr attr Str Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword Num body Raise Call NameLoad Call AttributeLoad Str attr keyword NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore AttributeLoad NameLoad attr body Assign NameStore TupleLoad SubscriptLoad AttributeLoad NameLoad attr Index Num BinOpSub Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad If UnaryOpNot Call NameLoad GeneratorExp CompareEq AttributeLoad NameLoad attr NameLoad comprehension NameStore AttributeLoad NameLoad attr body If Call NameLoad GeneratorExp CompareEq SubscriptLoad NameLoad Index Num SubscriptLoad SubscriptLoad NameLoad Index Num Index Num comprehension NameStore NameLoad body If NameLoad body Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Slice Num Num Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad orelse If Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TupleLoad Num Num orelse Assign NameStore Call NameLoad NameLoad AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr TupleLoad Num Num Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr For NameStore Call AttributeLoad Call NameLoad NameLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Call NameLoad Call AttributeLoad NameLoad attr NameLoad Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list decorator_list
N/A itertools combinations collections defaultdict N/A numpy np N/A networkx nx pgmpy.factors TabularCPD pgmpy.base DirectedGraph UndirectedGraph DynamicBayesianNetwork N/A DirectedGraph N/A __init__ N/A N/A self ebunch N/A None N/A N/A 
        Base class for Dynamic Bayesian Network

        This is a time variant model of the static Bayesian model, where each
        time-slice has some static nodes and is then replicated over a certain
        time period.

        The nodes can be any hashable python objects.

        Parameters:
        ----------
        ebunch: Data to initialize graph.  If data=None (default) an empty
              graph is created.  The data can be an edge list, or any NetworkX
              graph object

        Examples:
        --------
        Create an empty Dynamic Bayesian Network with no nodes and no edges:
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()

        Adding nodes and edges inside the dynamic bayesian network. A single
        node can be added using the method below. For adding edges we need to
        specify the time slice since edges can be across different time slices.

        For example for a network as [image](http://s8.postimg.org/aaybw4x2t/Blank_Flowchart_New_Page_1.png),
        we will need to add all the edges in the 2-TBN as:

        >>> dbn.add_edges_from([(('D', 0), ('G', 0)), (('I', 0), ('G', 0)),
        ...                     (('G', 0), ('L', 0)), (('D', 0), ('D', 1)),
        ...                     (('I', 0), ('I', 1)), (('G', 0), ('G', 1)),
        ...                     (('G', 0), ('L', 1)), (('L', 0), ('L', 1))])

        We can query the edges and nodes in the network as:
        >>> dbn.nodes()
        ['G', 'D', 'I', 'L']
        >>> dbn.edges()
        [(('D', 1), ('G', 1)), (('I', 0), ('G', 0)), (('I', 0), ('I', 1)),
         (('I', 1), ('G', 1)), (('G', 0), ('L', 0)), (('G', 0), ('G', 1)),
         (('G', 0), ('L', 1)), (('D', 0), ('G', 0)), (('D', 0), ('D', 1)),
         (('L', 0), ('L', 1)), (('G', 1), ('L', 1))]

        If any variable is not present in the network while adding an edge,
        pgmpy will automatically add that variable to the network.

        But for adding nodes to the model we don't need to specify the time
        slice as it is common in all the time slices. And therefore pgmpy
        automatically replicated it all the time slices. For example, for
        adding a new variable `S` in the above network we can simply do:
        >>> dbn.add_node('S')
        >>> dbn.nodes()
        ['S', 'G', 'D', 'I', 'L']

        Public Methods:
        ---------------
        add_node
        add_nodes_from
        add_edges
        add_edges_from
        add_cpds
        initialize_initial_state
        inter_slice
        intra_slice
        copy
         N/A N/A N/A N/A super DynamicBayesianNetwork self __init__ N/A ebunch N/A N/A N/A N/A self add_edges_from ebunch N/A N/A self cpds N/A N/A N/A self cardinalities N/A defaultdict int N/A add_node N/A N/A self node N/A attr N/A N/A 
        Adds a single node to the Network

        Parameters
        ----------
        node: node
            A node can be any hashable Python object.

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_node('A')
        ['A']
         N/A N/A N/A N/A super DynamicBayesianNetwork self add_node N/A node 0 attr N/A add_nodes_from N/A N/A self nodes N/A attr N/A N/A 
        Add multiple nodes to the Network.

        Parameters
        ----------
        nodes: iterable container
            A container of nodes (list, dict, set, etc.).

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_nodes_from(['A', 'B', 'C'])
         N/A node nodes N/A N/A N/A N/A self add_node node N/A nodes N/A N/A self N/A N/A N/A 
        Returns the list of nodes present in the network

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_nodes_from(['A', 'B', 'C'])
        >>> dbn.nodes()
        ['B', 'A', 'C']
         N/A N/A list N/A set N/A node N/A N/A node timeslice N/A N/A N/A super DynamicBayesianNetwork self nodes N/A add_edge N/A N/A self start end N/A kwargs N/A N/A 
        Add an edge between two nodes.

        The nodes will be automatically added if they are not present in the network.

        Parameters
        ----------
        start: tuple
               Both the start and end nodes should specify the time slice as
               (node_name, time_slice). Here, node_name can be any hashable
               python object while the time_slice is an integer value,
               which denotes the time slice that the node belongs to.

        end: tuple
               Both the start and end nodes should specify the time slice as
               (node_name, time_slice). Here, node_name can be any hashable
               python object while the time_slice is an integer value,
               which denotes the time slice that the node belongs to.

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> model = DBN()
        >>> model.add_nodes_from(['D', 'I'])
        >>> model.add_edge(('D',0), ('I',0))
        >>> model.edges()
        [(('D', 1), ('I', 1)), (('D', 0), ('I', 0))]
         N/A N/A N/A N/A N/A N/A len start 2 N/A N/A len end 2 N/A N/A N/A ValueError Nodes must be of type (node, time_slice). N/A N/A N/A N/A N/A isinstance N/A start N/A 1 int N/A N/A isinstance N/A end N/A 1 int N/A N/A N/A ValueError Nodes must be of type (node, time_slice). N/A N/A N/A N/A start N/A 1 N/A end N/A 1 N/A N/A start N/A N/A start N/A 0 0 N/A end N/A N/A end N/A 0 0 N/A N/A N/A N/A start N/A 1 N/A N/A end N/A 1 1 N/A N/A start N/A N/A start N/A 0 0 N/A end N/A N/A end N/A 0 1 N/A N/A N/A N/A start N/A 1 N/A end N/A 1 N/A N/A N/A NotImplementedError Edges in backward direction are not allowed. N/A N/A N/A N/A start N/A 1 N/A end N/A 1 N/A N/A N/A ValueError Edges over multiple time slices is not currently supported N/A N/A N/A TypeError N/A N/A N/A ValueError Nodes must be of type (node, time_slice). N/A N/A start end N/A N/A N/A ValueError Self Loops are not allowed N/A N/A N/A N/A start N/A N/A N/A super DynamicBayesianNetwork self nodes N/A end N/A N/A N/A super DynamicBayesianNetwork self nodes N/A N/A nx has_path self end start N/A N/A N/A ValueError N/A N/A Loops are not allowed. Adding the edge from ({start} --> {end}) forms a loop. format start N/A str start end N/A str end N/A N/A N/A N/A super DynamicBayesianNetwork self add_edge start end kwargs N/A N/A N/A start N/A 1 N/A end N/A 1 N/A N/A N/A N/A N/A super DynamicBayesianNetwork self add_edge N/A N/A start N/A 0 N/A 1 N/A start N/A 1 N/A N/A end N/A 0 N/A 1 N/A end N/A 1 N/A N/A N/A N/A N/A super DynamicBayesianNetwork self add_node N/A N/A end N/A 0 N/A 1 N/A end N/A 1 N/A add_edges_from N/A N/A self ebunch N/A kwargs N/A N/A 
        Add all the edges in ebunch.

        If nodes referred in the ebunch are not already present, they
        will be automatically added. Node names can be any hashable python object.

        Parameters
        ----------
        ebunch : list, array-like
                List of edges to add. Each edge must be of the form of
                ((start, time_slice), (end, time_slice)).

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_edges_from([(('D', 0), ('G', 0)), (('I', 0), ('G', 0))])
        >>> dbn.nodes()
        ['G', 'I', 'D']
        >>> dbn.edges()
        [(('D', 1), ('G', 1)),
         (('I', 1), ('G', 1)),
         (('D', 0), ('G', 0)),
         (('I', 0), ('G', 0))]
         N/A edge ebunch N/A N/A N/A N/A self add_edge N/A edge N/A 0 N/A edge N/A 1 N/A get_intra_edges N/A N/A self time_slice N/A 0 N/A N/A 
        Returns the intra slice edges present in the 2-TBN.

        Parameter
        ---------
        time_slice: int (whole number)
                The time slice for which to get intra edges. The timeslice
                should be a positive value or zero.

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_nodes_from(['D', 'G', 'I', 'S', 'L'])
        >>> dbn.add_edges_from([(('D', 0), ('G', 0)), (('I', 0), ('G', 0)),
        ...                     (('G', 0), ('L', 0)), (('D', 0), ('D', 1)),
        ...                     (('I', 0), ('I', 1)), (('G', 0), ('G', 1)),
        ...                     (('G', 0), ('L', 1)), (('L', 0), ('L', 1))])
        >>> dbn.get_intra_edges()
        [(('D', 0), ('G', 0)), (('G', 0), ('L', 0)), (('I', 0), ('G', 0))
         N/A N/A N/A N/A isinstance time_slice int N/A time_slice 0 N/A N/A N/A ValueError The timeslice should be a positive value greater than or equal to zero N/A N/A N/A tuple N/A N/A N/A x N/A 0 time_slice N/A x edge N/A edge N/A N/A self edges N/A N/A N/A edge N/A 0 N/A 1 N/A N/A edge N/A 1 N/A 1 0 N/A get_inter_edges N/A N/A self N/A N/A N/A 
        Returns the inter-slice edges present in the 2-TBN.

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_edges_from([(('D', 0), ('G', 0)), (('I', 0), ('G', 0)),
        ...                     (('G', 0), ('L', 0)), (('D', 0), ('D', 1)),
        ...                     (('I', 0), ('I', 1)), (('G', 0), ('G', 1)),
        ...                     (('G', 0), ('L', 1)), (('L', 0), ('L', 1))])
        >>> dbn.get_inter_edges()
        [(('D', 0), ('D', 1)),
         (('G', 0), ('G', 1)),
         (('G', 0), ('L', 1)),
         (('I', 0), ('I', 1)),
         (('L', 0), ('L', 1))]
         N/A N/A edge N/A edge N/A N/A self edges N/A N/A N/A edge N/A 0 N/A 1 N/A N/A edge N/A 1 N/A 1 N/A get_interface_nodes N/A N/A self time_slice N/A 0 N/A N/A 
        Returns the nodes in the first timeslice whose children are present in the first timeslice.

        Parameter
        ---------
        time_slice:int
                The timeslice should be a positive value greater than or equal to zero

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_nodes_from(['D', 'G', 'I', 'S', 'L'])
        >>> dbn.add_edges_from([(('D',0),('G',0)),(('I',0),('G',0)),(('G',0),('L',0)),(('D',0),('D',1))])
        >>> dbn.get_interface_nodes()
        [('D', 0)]
         N/A N/A N/A N/A isinstance time_slice int N/A time_slice 0 N/A N/A N/A ValueError The timeslice should be a positive value greater than or equal to zero N/A N/A N/A N/A N/A edge N/A 0 N/A 0 time_slice N/A edge N/A N/A self get_inter_edges N/A get_slice_nodes N/A N/A self time_slice N/A 0 N/A N/A 
        Returns the nodes present in a particular timeslice

        Parameter
        ---------
        time_slice:int
                The timeslice should be a positive value greater than or equal to zero

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN()
        >>> dbn.add_nodes_from(['D', 'G', 'I', 'S', 'L'])
        >>> dbn.add_edges_from([(('D', 0),('G', 0)),(('I', 0),('G', 0)),(('G', 0),('L', 0)),(('D', 0),('D', 1))])
        >>> dbn.get_slice_nodes()
         N/A N/A N/A N/A isinstance time_slice int N/A time_slice 0 N/A N/A N/A ValueError The timeslice should be a positive value greater than or equal to zero N/A N/A N/A node time_slice N/A node N/A N/A self nodes N/A add_cpds N/A N/A self N/A cpds N/A N/A 
        This method adds the cpds to the dynamic bayesian network.
        Note that while adding variables and the evidence in cpd,
        they have to be of the following form
        (node_name, time_slice)
        Here, node_name is the node that is inserted
        while the time_slice is an integer value, which denotes
        the index of the time_slice that the node belongs to.

        Parameter
        ---------
        cpds : list, set, tuple (array-like)
            List of CPDs which are to be associated with the model. Each CPD
            should be an instance of `TabularCPD`.

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> from pgmpy.factors import TabularCPD
        >>> dbn = DBN()
        >>> dbn.add_edges_from([(('D', 0),('G', 0)),(('I', 0),('G', 0)),(('D', 0),('D', 1)),(('I', 0),('I', 1))])
        >>> grade_cpd = TabularCPD(('G', 0), 3, [[0.3, 0.05, 0.9, 0.5],
        ...                                      [0.4, 0.25, 0.8, 0.03],
        ...                                      [0.3, 0.7, 0.02, 0.2]],
        ...                        evidence=[('I', 0),('D', 0)],
        ...                        evidence_card=[2, 2])
        >>> d_i_cpd = TabularCPD(('D',1), 2, [[0.6, 0.3],
        ...                                   [0.4, 0.7]],
        ...                      evidence=[('D',0)],
        ...                      evidence_card=2)
        >>> diff_cpd = TabularCPD(('D', 0), 2, [[0.6, 0.4]])
        >>> intel_cpd = TabularCPD(('I', 0), 2, [[0.7, 0.3]])
        >>> i_i_cpd = TabularCPD(('I', 1), 2, [[0.5, 0.4],
        ...                                    [0.5, 0.6]],
        ...                      evidence=[('I', 0)],
        ...                      evidence_card=2)
        >>> dbn.add_cpds(grade_cpd, d_i_cpd, diff_cpd, intel_cpd, i_i_cpd)
        >>> dbn.get_cpds()
        [<TabularCPD representing P(('G', 0):3 | ('I', 0):2, ('D', 0):2) at 0x7ff7f27b0cf8>,
         <TabularCPD representing P(('D', 1):2 | ('D', 0):2) at 0x7ff810b9c2e8>,
         <TabularCPD representing P(('D', 0):2) at 0x7ff7f27e6f98>,
         <TabularCPD representing P(('I', 0):2) at 0x7ff7f27e6ba8>,
         <TabularCPD representing P(('I', 1):2 | ('I', 0):2) at 0x7ff7f27e6668>]
         N/A cpd cpds N/A N/A N/A N/A isinstance cpd TabularCPD N/A N/A N/A ValueError cpd should be an instance of TabularCPD N/A N/A N/A set N/A cpd variables N/A N/A N/A set N/A cpd variables intersection N/A set N/A N/A N/A super DynamicBayesianNetwork self nodes N/A N/A N/A ValueError CPD defined on variable not in the model cpd N/A N/A N/A N/A self cpds extend cpds N/A get_cpds N/A N/A self node time_slice N/A None 0 N/A N/A 
        Returns the CPDs that have been associated with the network.

        Parameter
        ---------
        node: tuple (node_name, time_slice)
            The node should be in the following form (node_name, time_slice).
            Here, node_name is the node that is inserted while the time_slice is
            an integer value, which denotes the index of the time_slice that the
            node belongs to.

        time_slice: int
            The time_slice should be a positive integer greater than or equal to zero.

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> from pgmpy.factors import TabularCPD
        >>> dbn = DBN()
        >>> dbn.add_edges_from([(('D',0),('G',0)),(('I',0),('G',0)),(('D',0),('D',1)),(('I',0),('I',1))])
        >>> grade_cpd =  TabularCPD(('G',0), 3, [[0.3,0.05,0.9,0.5],
        ...                                      [0.4,0.25,0.8,0.03],
        ...                                      [0.3,0.7,0.02,0.2]], [('I', 0),('D', 0)],[2,2])
        >>> dbn.add_cpds(grade_cpd)
        >>> dbn.get_cpds()
         N/A node N/A N/A N/A node N/A N/A N/A super DynamicBayesianNetwork self nodes N/A N/A N/A ValueError Node not present in the model. N/A N/A cpd N/A self cpds N/A N/A N/A N/A cpd variable node N/A N/A cpd N/A N/A N/A cpd N/A cpd N/A self cpds N/A N/A N/A set N/A list N/A cpd variables issubset N/A N/A self get_slice_nodes time_slice N/A remove_cpds N/A N/A self N/A cpds N/A N/A 
        Removes the cpds that are provided in the argument.

        Parameters
        ----------
        *cpds : list, set, tuple (array-like)
            List of CPDs which are to be associated with the model. Each CPD
            should be an instance of `TabularCPD`.

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> from pgmpy.factors import TabularCPD
        >>> dbn = DBN()
        >>> dbn.add_edges_from([(('D',0),('G',0)),(('I',0),('G',0)),(('D',0),('D',1)),(('I',0),('I',1))])
        >>> grade_cpd =  TabularCPD(('G',0), 3, [[0.3,0.05,0.9,0.5],
        ...                                      [0.4,0.25,0.8,0.03],
        ...                                      [0.3,0.7,0.02,0.2]], [('I', 0),('D', 0)],[2,2])
        >>> dbn.add_cpds(grade_cpd)
        >>> dbn.get_cpds()
        [<TabularCPD representing P(('G', 0):3 | ('I', 0):2, ('D', 0):2) at 0x3348ab0>]
        >>> dbn.remove_cpds(grade_cpd)
        >>> dbn.get_cpds()
        []
         N/A cpd cpds N/A N/A N/A isinstance cpd N/A tuple list N/A N/A cpd N/A N/A self get_cpds cpd N/A N/A N/A N/A self cpds remove cpd N/A check_model N/A N/A self N/A N/A N/A 
        Check the model for various errors. This method checks for the following
        errors.

        * Checks if the sum of the probabilities in each associated CPD for each
            state is equal to 1 (tol=0.01).
        * Checks if the CPDs associated with nodes are consistent with their parents.

        Returns
        -------
        boolean: True if everything seems to be order. Otherwise raises error
            according to the problem.
         N/A node N/A N/A N/A super DynamicBayesianNetwork self nodes N/A N/A cpd N/A N/A self get_cpds node node N/A N/A isinstance cpd TabularCPD N/A N/A evidence N/A N/A cpd variables N/A 0 -1 N/A evidence_card N/A N/A cpd cardinality N/A 0 -1 N/A parents N/A N/A self get_parents node N/A N/A N/A set evidence N/A set N/A parents parents N/A N/A N/A N/A ValueError N/A N/A CPD associated with {node} doesn't have proper parents associated with it. format node node N/A N/A N/A N/A np allclose N/A N/A N/A N/A N/A N/A N/A cpd to_factor marginalize N/A node inplace False values flatten C N/A N/A np ones N/A N/A np product evidence_card atol 0.01 N/A N/A N/A ValueError N/A N/A Sum of probabilities of states for node {node} is not equal to 1 format node node N/A True N/A initialize_initial_state N/A N/A self N/A N/A N/A 
        This method will automatically re-adjust the cpds and the edges added to the bayesian network.
        If an edge that is added as an intra time slice edge in the 0th timeslice, this method will
        automatically add it in the 1st timeslice. It will also add the cpds. However, to call this
        method, one needs to add cpds as well as the edges in the bayesian network of the whole
        skeleton including the 0th and the 1st timeslice,.

        Examples:
        -------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> from pgmpy.factors import TabularCPD
        >>> student = DBN()
        >>> student.add_nodes_from(['D', 'G', 'I', 'S', 'L'])
        >>> student.add_edges_from([(('D', 0),('G', 0)),(('I', 0),('G', 0)),(('D', 0),('D', 1)),(('I', 0),('I', 1))])
        >>> grade_cpd = TabularCPD(('G', 0), 3, [[0.3, 0.05, 0.9, 0.5],
        ...                                      [0.4, 0.25, 0.8, 0.03],
        ...                                      [0.3, 0.7, 0.02, 0.2]],
        ...                        evidence=[('I', 0),('D', 0)],
        ...                        evidence_card=[2, 2])
        >>> d_i_cpd = TabularCPD(('D', 1), 2, [[0.6, 0.3],
        ...                                    [0.4, 0.7]],
        ...                      evidence=[('D', 0)],
        ...                      evidence_card=2)
        >>> diff_cpd = TabularCPD(('D', 0), 2, [[0.6, 0.4]])
        >>> intel_cpd = TabularCPD(('I',0), 2, [[0.7, 0.3]])
        >>> i_i_cpd = TabularCPD(('I', 1), 2, [[0.5, 0.4],
        ...                                    [0.5, 0.6]],
        ...                      evidence=[('I', 0)],
        ...                      evidence_card=2)
        >>> student.add_cpds(grade_cpd, d_i_cpd, diff_cpd, intel_cpd, i_i_cpd)
        >>> student.initialize_initial_state()
         N/A cpd N/A self cpds N/A N/A temp_var N/A N/A N/A cpd variable N/A 0 N/A 1 N/A N/A cpd variable N/A 1 N/A parents N/A N/A self get_parents temp_var N/A N/A N/A any N/A N/A N/A x variable temp_var N/A x N/A self cpds N/A N/A N/A all N/A N/A N/A x N/A 1 N/A N/A parents N/A 0 N/A 1 N/A x parents N/A N/A parents N/A N/A evidence_card N/A N/A cpd cardinality N/A 0 -1 N/A new_cpd N/A TabularCPD temp_var N/A cpd variable_card N/A N/A N/A cpd values reshape N/A cpd variable_card N/A N/A np prod evidence_card parents evidence_card N/A N/A N/A N/A cpd get_evidence N/A N/A initial_cpd N/A N/A cpd marginalize N/A N/A cpd get_evidence inplace False N/A new_cpd N/A TabularCPD temp_var N/A cpd variable_card N/A N/A np reshape N/A initial_cpd values N/A -1 2 N/A N/A new_cpd N/A TabularCPD temp_var N/A cpd variable_card N/A N/A np reshape N/A cpd values N/A -1 2 N/A N/A N/A self add_cpds new_cpd N/A N/A N/A self check_model N/A moralize N/A N/A self N/A N/A N/A 
        Removes all the immoralities in the Network and creates a moral
        graph (UndirectedGraph).

        A v-structure X->Z<-Y is an immorality if there is no directed edge
        between X and Y.

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> dbn = DBN([(('D',0), ('G',0)), (('I',0), ('G',0))])
        >>> moral_graph = dbn.moralize()
        >>> moral_graph.edges()
        [(('G', 0), ('I', 0)),
        (('G', 0), ('D', 0)),
        (('D', 1), ('I', 1)),
        (('D', 1), ('G', 1)),
        (('I', 0), ('D', 0)),
        (('G', 1), ('I', 1))]
         N/A moral_graph N/A N/A self to_undirected N/A node N/A N/A N/A super DynamicBayesianNetwork self nodes N/A N/A N/A N/A moral_graph add_edges_from N/A combinations N/A N/A self get_parents node 2 N/A moral_graph N/A copy N/A N/A self N/A N/A N/A 
        Returns a copy of the dynamic bayesian network.

        Returns
        -------
        DynamicBayesianNetwork: copy of the dynamic bayesian network

        Examples
        --------
        >>> from pgmpy.models import DynamicBayesianNetwork as DBN
        >>> from pgmpy.factors import TabularCPD
        >>> dbn = DBN()
        >>> dbn.add_edges_from([(('D',0),('G',0)),(('I',0),('G',0)),(('D',0),('D',1)),(('I',0),('I',1))])
        >>> grade_cpd =  TabularCPD(('G',0), 3, [[0.3,0.05,0.9,0.5],
                                        [0.4,0.25,0.8,0.03],
                                        [0.3,0.7,0.02,0.2]], [('I', 0),('D', 0)],[2,2])
        >>> dbn.add_cpds(grade_cpd)
        >>> dbn_copy = dbn.copy()
        >>> dbn_copy.nodes()
        ['Z', 'G', 'I', 'D']
        >>> dbn_copy.edges()
        [(('I', 1), ('G', 1)),
        (('I', 0), ('I', 1)),
        (('I', 0), ('G', 0)),
        (('D', 1), ('G', 1)),
        (('D', 0), ('G', 0)),
        (('D', 0), ('D', 1))]
        >> dbn_copy.get_cpds()
        [<TabularCPD representing P(('G', 0):3 | ('I', 0):2, ('D', 0):2) at 0x7f13961a3320>]
         N/A dbn N/A DynamicBayesianNetwork N/A N/A N/A dbn add_nodes_from N/A N/A self nodes N/A N/A N/A dbn add_edges_from N/A N/A self edges N/A cpd_copy N/A N/A N/A cpd copy N/A cpd N/A N/A self get_cpds N/A N/A N/A dbn add_cpds cpd_copy N/A dbn N/A N/A