docstr: Calculate the log probability of each example.
  
  This method calculates the log probability of each example given the
  parameters of the distribution. The examples must be given in a 2D
  format. For a Bernoulli distribution, each entry in the data must
  be either 0 or 1.
  
  Note: This differs from some other log probability calculation
  functions, like those in torch.distributions, because it is not
  returning the log probability of each feature independently, but rather
  the total log probability of the entire example.
  
  
  Parameters
  ----------
  X: list, tuple, numpy.ndarray, torch.Tensor, shape=(-1, self.d)
          A set of examples to evaluate.
  
  priors: list, numpy.ndarray, torch.Tensor, shape=(-1, self.k)
          Prior probabilities of assigning each symbol to each node. If not
          provided, do not include in the calculations (conceptually
          equivalent to a uniform probability, but without scaling the
          probabilities). This can be used to assign labels to observatons
          by setting one of the probabilities for an observation to 1.0.
          Note that this can be used to assign hard labels, but does not
          have the same semantics for soft labels, in that it only
          influences the initial estimate of an observation being generated
          by a component, not gives a target. Default is None.
  
  
  Returns
  -------
  logp: torch.Tensor, shape=(-1,)
          The log probability of each example.
docstr_tok: ["Calculate","the","log","probability","of","each","example",".","This","method","calculates","the","log","probability","of","each","example","given","the","parameters","of","the","distribution",".","The","examples","must","be","given","in","a","2D","format",".","For","a","Bernoulli","distribution",",","each","entry","in","the","data","must","be","either","0","or","1",".","Note",":","This","differs","from","some","other","log","probability","calculation","functions",",","like","those","in","torch.distributions",",","because","it","is","not","returning","the","log","probability","of","each","feature","independently",",","but","rather","the","total","log","probability","of","the","entire","example",".","Parameters","--","--","--","--","--","X",":","list",",","tuple",",","numpy.ndarray",",","torch.Tensor",",","shape=","(","-1",",","self.d",")","A","set","of","examples","to","evaluate",".","priors",":","list",",","numpy.ndarray",",","torch.Tensor",",","shape=","(","-1",",","self.k",")","Prior","probabilities","of","assigning","each","symbol","to","each","node",".","If","not","provided",",","do","not","include","in","the","calculations","(","conceptually","equivalent","to","a","uniform","probability",",","but","without","scaling","the","probabilities",")",".","This","can","be","used","to","assign","labels","to","observatons","by","setting","one","of","the","probabilities","for","an","observation","to","1.0",".","Note","that","this","can","be","used","to","assign","hard","labels",",","but","does","not","have","the","same","semantics","for","soft","labels",",","in","that","it","only","influences","the","initial","estimate","of","an","observation","being","generated","by","a","component",",","not","gives","a","target",".","Default","is","None",".","Returns","--","--","--","-","logp",":","torch.Tensor",",","shape=","(","-1",",",")","The","log","probability","of","each","example","."]
code: def log_probability(self, X, priors=None):
      """Calculate the log probability of each example.
  
      This method calculates the log probability of each example given the
      parameters of the distribution. The examples must be given in a 2D
      format. For a Bernoulli distribution, each entry in the data must
      be either 0 or 1.
  
      Note: This differs from some other log probability calculation
      functions, like those in torch.distributions, because it is not
      returning the log probability of each feature independently, but rather
      the total log probability of the entire example.
  
  
      Parameters
      ----------
      X: list, tuple, numpy.ndarray, torch.Tensor, shape=(-1, self.d)
              A set of examples to evaluate.
  
      priors: list, numpy.ndarray, torch.Tensor, shape=(-1, self.k)
              Prior probabilities of assigning each symbol to each node. If not
              provided, do not include in the calculations (conceptually
              equivalent to a uniform probability, but without scaling the
              probabilities). This can be used to assign labels to observatons
              by setting one of the probabilities for an observation to 1.0.
              Note that this can be used to assign hard labels, but does not
              have the same semantics for soft labels, in that it only
              influences the initial estimate of an observation being generated
              by a component, not gives a target. Default is None.
  
  
      Returns
      -------
      logp: torch.Tensor, shape=(-1,)
              The log probability of each example.
      """
  
      e = self._emission_matrix(X, priors=priors)
      return torch.logsumexp(e, dim=1)
  
file_path: pomegranate/pomegranate/_bayes.py
imports: import torch
  from ._utils import _cast_as_tensor
  from ._utils import _update_parameter
  from ._utils import _check_parameter
  from ._utils import _reshape_weights
  from .distributions._distribution import Distribution
label_desc: Use image node_id 4 for calling the BayesMixin obj's underlying member method code with example usage: obj.log_probability(X, priors) and returns: torch