Module pacai.util.probability
Various utilities for working with probabilities and distributions.
Functions
def flipCoin(p)
def getProbability(value, distribution, values)
-
Gives the probability of a value under a discrete distribution defined by (distributions, values).
def nSample(distribution, values, n)
def normalize(listOrDict)
-
Normalize a list or dictionary by dividing each value by the sum of all values, resulting in values to be in range [0, 1]. Requirements for listOrDict argument: 1. Must be non-empty. 2. For a dict, each value must be >= 0 and the sum must be > 0.
def sample(distribution, values=None)