Navigation :
random.binomial
random.binomial, function
def autodiff pure random.binomial(p: number): boolean
Draws a Bernoulli sample with success probability p.
p: the success probability, between 0 and 1 (inclusive).
Example
montecarlo 10000 with
x = random.binomial(0.3)
sample rate = avg(if x then 1 else 0)
show scalar "Success rate" with rate
This outputs the following scalar:
This function is usable in autodiff blocks, but no
gradient flows through it.