pangolin.interface.bernoulli#
- pangolin.interface.bernoulli(theta)#
Create a
Bernoullidistributed RV (Wikipedia).This function belongs to the default interface. Thus, all arguments must either be scalar or mutually broadcastable using simple broadcasting, unless changed within an
overload()block.- Parameters:
theta (RVLike) – probability (between 0 and 1).
- Returns:
ir.RV – RV whose operation is
pangolin.ir.Bernoulliwhen all parents are scalar, or one or more nestedpangolin.ir.VMapoperations around that type when broadcasting is required. The operation has 1 parent.- Return type:
Examples
>>> import pangolin.interface as pi >>> x = pi.bernoulli(0.1) >>> x RV(Bernoulli(), RV(Constant(0.1))) >>> x.shape () >>> y = pi.bernoulli([0.1, 0.1]) >>> y RV(VMap(Bernoulli(), [0], 2), RV(Constant([0.1,0.1]))) >>> y.shape (2,)
See also