concept

Events and conditional probability

Conditional probability restricts a model to an event of positive probability. In finite uniform fixtures divide the intersection count by the conditioning count; an empty condition is undefined.

Formal Syntax & Structure

artificial-intelligence syntaxartificial-intelligence
P(D | A) = P(D and A) / P(A), P(A) > 0

Working Example

Example Snippetartificial-intelligence
def rate(matches, total):    if total < 0 or matches < 0 or matches > total:        raise ValueError("Invalid counts")    if total == 0:        return None    return matches / total
print(rate(3, 20))print(rate(2, 8))print(round(rate(2, 3), 3))print(rate(0, 0))