Bayes Theorem

import numpy as np
import matplotlib.pyplot as plt

def bayes(pEgH, pEnH, pH):
    """
pEgH: p evidence given hypothesis (true positivity)
pEnH: p evidence not given hypothesis (false positivity)
pH:   p hypothesis (prior)
"""
    return (pEgH * pH) / (pEgH * pH + pEnH * (1-pH))

pEgH = 0.9
pEnH = 0.1

priors = np.arange(0, 0.1, 1e-4)
probabilities = list(map(lambda p: bayes(pEgH, pEnH, p), priors))
plt.plot(priors, probabilities)