Binary

class qdflow.util.distribution.Binary(p, success, fail)

Bases: Distribution[T], Generic[T]

A binary (Bernoulli) distribution, which returns success with probability p, and fail otherwise.

Parameters:
  • p (float) – The probability success will be returned. Must be between 0 and 1.

  • success (T) – The value to return with probabilty p.

  • fail (T) – The value to return with probabilty 1-p.

__init__(p, success, fail)

Methods

draw(rng[, size])

Draws one or more samples from the distribution.