Module Expr Str Import alias identifier ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad attr Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Call NameLoad Assign NameStore Call NameLoad FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Expr Call AttributeLoad Call NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore TupleLoad AttributeLoad NameLoad attr Assign NameStore ListLoad NameLoad Return TupleLoad NameLoad NameLoad TupleLoad TupleLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Call AttributeLoad AttributeLoad NameLoad attr attr Num AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore BinOpDiv Num BinOpAdd Num Call AttributeLoad NameLoad attr UnaryOpUSub SubscriptLoad AttributeLoad NameLoad attr Index Num Return BinOpMod Str TupleLoad AttributeLoad NameLoad attr NameLoad decorator_list decorator_list ImportFrom alias ImportFrom alias alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults kwarg body Expr Str If UnaryOpNot Call NameLoad AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad Str Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Index Num If CompareNotEq NameLoad Num body Raise Call AttributeLoad NameLoad attr Str Assign NameStore TupleLoad TupleLoad Assign AttributeStore NameLoad attr Call NameLoad Assign AttributeStore NameLoad attr TupleLoad Call NameLoad Num Expr Call AttributeLoad Call NameLoad attr NameLoad keyword NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad SubscriptLoad NameLoad Index Num ExtSlice Ellipsis Index Num Assign NameStore ListLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str If CompareEq NameLoad Num body Assign NameStore Call AttributeLoad NameLoad attr ListLoad SubscriptLoad SubscriptLoad NameLoad Index Num ExtSlice Ellipsis Index NameLoad SubscriptLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num ExtSlice Ellipsis Index NameLoad keyword Num Return ListLoad NameLoad orelse Raise Call NameLoad Str decorator_list decorator_list Expr Call AttributeLoad NameLoad attr NameLoad NameLoad
N/A N/A 
A module for the Bernoulli distribution node
 N/A numpy np binomial BinomialMoments BinomialDistribution expfamily ExponentialFamily beta BetaMoments node Moments BernoulliMoments N/A BinomialMoments N/A N/A 
    Class for the moments of Bernoulli variables.
     __init__ N/A N/A self N/A N/A N/A N/A N/A N/A super __init__ 1 N/A N/A BernoulliDistribution N/A BinomialDistribution N/A N/A 
    Class for the VMP formulas of Bernoulli variables.
     __init__ N/A N/A self N/A N/A N/A N/A N/A N/A super __init__ 1 N/A N/A Bernoulli N/A ExponentialFamily N/A N/A 
    Node for Bernoulli random variables.

    The node models a binary random variable :math:`z \in \{0,1\}` with prior
    probability :math:`p \in [0,1]` for value one:

    .. math::

        z \sim \mathrm{Bernoulli}(p).

    Parameters
    ----------
    p : beta-like node
        Probability of a successful trial

    Examples
    --------

    >>> import warnings
    >>> warnings.filterwarnings('ignore', category=RuntimeWarning)
    >>> from bayespy.nodes import Bernoulli, Beta
    >>> p = Beta([1e-3, 1e-3])
    >>> z = Bernoulli(p, plates=(10,))
    >>> z.observe([0, 1, 1, 1, 0, 1, 1, 1, 0, 1])
    >>> p.update()
    >>> import bayespy.plot as bpplt
    >>> import numpy as np
    >>> bpplt.pdf(p, np.linspace(0, 1, num=100))
    [<matplotlib.lines.Line2D object at 0x...>]
     N/A _moments N/A BernoulliMoments N/A _distribution N/A BernoulliDistribution __init__ N/A N/A self p N/A kwargs N/A N/A 
        Create Bernoulli node.
         N/A N/A N/A N/A super __init__ p kwargs N/A _constructor N/A N/A cls p N/A kwargs N/A N/A 
        Constructs distribution and moments objects.
         N/A p N/A N/A cls _ensure_moments p BetaMoments N/A parent_moments N/A N/A p _moments N/A parents N/A p N/A N/A parents kwargs N/A N/A N/A N/A cls _total_plates N/A N/A kwargs get plates N/A N/A N/A cls _distribution plates_from_parent 0 N/A p plates N/A cls _distribution N/A cls _moments parent_moments N/A classmethod __str__ N/A N/A self N/A N/A N/A 
        Print the distribution using standard parameterization.
         N/A p N/A 1 N/A 1 N/A N/A np exp N/A N/A N/A self phi N/A 0 N/A N/A %s ~ Bernoulli(p)
  p = 
%s
 N/A N/A self name p N/A N/A deterministic Deterministic categorical Categorical CategoricalMoments CategoricalToBernoulli N/A Deterministic N/A N/A 
    A node for converting 2-class categorical moments to Bernoulli moments.
     __init__ N/A N/A self Z N/A kwargs N/A N/A 
        Create a categorical MC moments to categorical moments conversion node.
         N/A N/A N/A isinstance N/A Z _moments CategoricalMoments N/A N/A N/A ValueError Input node must be categorical N/A K N/A N/A N/A Z dims N/A 0 N/A -1 N/A N/A K 2 N/A N/A N/A N/A Moments NoConverterError Only 2-class categorical can be converted to Bernoulli N/A dims N/A N/A N/A N/A self _moments N/A BernoulliMoments N/A N/A self _parent_moments N/A N/A CategoricalMoments 2 N/A N/A N/A N/A super __init__ Z dims dims kwargs N/A _compute_moments N/A N/A self u_Z N/A N/A N/A 
        Compute the moments given the moments of the parents.
         N/A u0 N/A N/A u_Z N/A 0 N/A N/A N/A 0 N/A u N/A u0 N/A u N/A _compute_message_to_parent N/A N/A self index m u_Z N/A N/A N/A 
        Compute the message to a parent.
         N/A N/A index 0 N/A N/A m0 N/A N/A np concatenate N/A N/A N/A m N/A 0 N/A N/A N/A None N/A N/A N/A np zeros N/A N/A np shape N/A m N/A 0 N/A N/A N/A None axis -1 N/A N/A m0 N/A N/A N/A ValueError Incorrect parent index N/A N/A N/A N/A N/A CategoricalMoments add_converter BernoulliMoments CategoricalToBernoulli