class_docstr: A Bayesian network object.
  
  A Bayesian network is a probability distribution where dependencies between
  variables are explicitly encoded in a graph structure and the lack of an
  edge represents a conditional independence. These graphs are directed and
  typically must be acyclic, but this implementation allows for the networks
  to be cyclic as long as there is no assumption of convergence during
  inference.
  
  Inference is doing using loopy belief propogation along a factor graph
  representation. This is sometimes called the `sum-product` algorithm.
  It will yield exact results if the graph has a tree-like structure.
  Otherwise, if the graph is acyclic, it is guaranteed to converge but not
  necessarily to optimal results. If the graph is cyclic, there is no
  guarantee on convergence, but it is thought that the longer the loop is the 
  more likely one will get good results.
  
  Structure learning can be done using a variety of methods. 
  
  
  Parameters
  ----------
  distributions: tuple or list or None
          A set of distribution objects. These do not need to be initialized,
          i.e. can be "Categorical()". Currently, they must be either Categorical
          or JointCategorical distributions. If provided, they must be consistent
          with the provided edges in that every conditional distribution must
          have at least one parent in the provided structure. Default is None.
  
  edges: tuple or list or None, optional
          A list or tuple of 2-tuples where the first element in the 2-tuple is 
          the parent distribution object and the second element is the child
          distribution object. If None, then no edges. Default is None.
  
  struture: tuple or list or None, optional
          A list or tuple of the parents for each distribution with a tuple
          containing no elements indicating a root node. For instance, 
          ((), (0,), (), (0, 2)) would represent a graph with four nodes, 
          where the second distribution has the first distribution as a parent 
          and the fourth distribution has the first and third distributions as 
          parents. Use this only when you want new distribution objects to be
          created and fit when using the `fit` method. Default is None.
  
  max_iter: int, optional
          The number of iterations to do in the inference step. Default is 10.
  
  tol: float, optional
          The threshold at which to stop during fitting when the improvement
          goes under. Default is 1e-6.
  
  inertia: float, [0, 1], optional
          Indicates the proportion of the update to apply to the parameters
          during fitting. When the inertia is 0.0, the update is applied in
          its entirety and the previous parameters are ignored. When the
          inertia is 1.0, the update is entirely ignored and the previous
          parameters are kept, equivalently to if the parameters were frozen.
  
  frozen: bool, optional
          Whether all the parameters associated with this distribution are frozen.
          If you want to freeze individual pameters, or individual values in those
          parameters, you must modify the `frozen` attribute of the tensor or
          parameter directly. Default is False.
  
  check_data: bool, optional
          Whether to check properties of the data and potentially recast it to
          torch.tensors. This does not prevent checking of parameters but can
          slightly speed up computation when you know that your inputs are valid.
          Setting this to False is also necessary for compiling. Default is True.
  
  verbose: bool, optional
          Whether to print the improvement and timings during training.
docstr: Infers the probability of each category given the model and data.
  
  This method infers a probability distribution for each of the missing 
  values in the data. It uses the factor graph representation of the
  Bayesian network to run the sum-product/loopy belief propogation
  algorithm.
  
  The input to this method must be a torch.masked.MaskedTensor where the
  mask specifies which variables are observed (mask = True) and which ones
  are not observed (mask = False) for each of the values. When setting
  mask = False, it does not matter what the corresponding value in the
  tensor is. Different sets of variables can be observed or missing in
  different examples. 
  
  An important note is that, because each variable can have a different
  number of categories in the categorical setting, the return is a list
  of tensors where each element in that list is the marginal probability
  distribution for that variable. More concretely: the first element will
  be the distribution of values for the first variable across all
  examples. When the first variable has been provided as evidence, the
  distribution will be clamped to the value provided as evidence.
  
  ..warning:: This inference is exact given a Bayesian network that has
  a tree-like structure, but is only approximate for other cases. When
  the network is acyclic, this procedure will converge, but if the graph
  contains cycles then there is no guarantee on convergence.
  
  
  Parameters
  ----------
  X: torch.masked.MaskedTensor, shape=(-1, d)
          The data to predict values for. The mask should correspond to
          whether the variable is observed in the example. 
  
  
  Returns
  -------
  y: list of tensors, shape=(d,)
          A list of tensors where each tensor contains the distribution of
          values for that dimension.
docstr_tok: ["Infers","the","probability","of","each","category","given","the","model","and","data",".","This","method","infers","a","probability","distribution","for","each","of","the","missing","values","in","the","data",".","It","uses","the","factor","graph","representation","of","the","Bayesian","network","to","run","the","sum-product\/loopy","belief","propogation","algorithm",".","The","input","to","this","method","must","be","a","torch.masked.MaskedTensor","where","the","mask","specifies","which","variables","are","observed","(","mask","=","True",")","and","which","ones","are","not","observed","(","mask","=","False",")","for","each","of","the","values",".","When","setting","mask","=","False",",","it","does","not","matter","what","the","corresponding","value","in","the","tensor","is",".","Different","sets","of","variables","can","be","observed","or","missing","in","different","examples",".","An","important","note","is","that",",","because","each","variable","can","have","a","different","number","of","categories","in","the","categorical","setting",",","the","return","is","a","list","of","tensors","where","each","element","in","that","list","is","the","marginal","probability","distribution","for","that","variable",".","More","concretely",":","the","first","element","will","be","the","distribution","of","values","for","the","first","variable","across","all","examples",".","When","the","first","variable","has","been","provided","as","evidence",",","the","distribution","will","be","clamped","to","the","value","provided","as","evidence",".","..","warning",":",":","This","inference","is","exact","given","a","Bayesian","network","that","has","a","tree-like","structure",",","but","is","only","approximate","for","other","cases",".","When","the","network","is","acyclic",",","this","procedure","will","converge",",","but","if","the","graph","contains","cycles","then","there","is","no","guarantee","on","convergence",".","Parameters","--","--","--","--","--","X",":","torch.masked.MaskedTensor",",","shape=","(","-1",",","d",")","The","data","to","predict","values","for",".","The","mask","should","correspond","to","whether","the","variable","is","observed","in","the","example",".","Returns","--","--","--","-","y",":","list","of","tensors",",","shape=","(","d",",",")","A","list","of","tensors","where","each","tensor","contains","the","distribution","of","values","for","that","dimension","."]
code: def predict_proba(self, X):
      """Infers the probability of each category given the model and data.
  
      This method infers a probability distribution for each of the missing
      values in the data. It uses the factor graph representation of the
      Bayesian network to run the sum-product/loopy belief propogation
      algorithm.
  
      The input to this method must be a torch.masked.MaskedTensor where the
      mask specifies which variables are observed (mask = True) and which ones
      are not observed (mask = False) for each of the values. When setting
      mask = False, it does not matter what the corresponding value in the
      tensor is. Different sets of variables can be observed or missing in
      different examples.
  
      An important note is that, because each variable can have a different
      number of categories in the categorical setting, the return is a list
      of tensors where each element in that list is the marginal probability
      distribution for that variable. More concretely: the first element will
      be the distribution of values for the first variable across all
      examples. When the first variable has been provided as evidence, the
      distribution will be clamped to the value provided as evidence.
  
      ..warning:: This inference is exact given a Bayesian network that has
      a tree-like structure, but is only approximate for other cases. When
      the network is acyclic, this procedure will converge, but if the graph
      contains cycles then there is no guarantee on convergence.
  
  
      Parameters
      ----------
      X: torch.masked.MaskedTensor, shape=(-1, d)
              The data to predict values for. The mask should correspond to
              whether the variable is observed in the example.
  
  
      Returns
      -------
      y: list of tensors, shape=(d,)
              A list of tensors where each tensor contains the distribution of
              values for that dimension.
      """
  
      return self._factor_graph.predict_proba(X)
  
imports: import time
  import numpy
  import torch
  import itertools
  import networkx
  from ._utils import _cast_as_tensor
  from ._utils import _cast_as_parameter
  from ._utils import _update_parameter
  from ._utils import _check_parameter
  from ._utils import _reshape_weights
  from .distributions._distribution import Distribution
  from .distributions import Categorical
  from .distributions import JointCategorical
  from .distributions import ConditionalCategorical
  from .factor_graph import FactorGraph
label_desc: Use image node_id 11 for calling the BayesianNetwork obj's underlying member method code with example usage: obj.predict_proba(X) and returns: self