def variance(q, eps, pmf=em_pmf):
    e = expected_error(q, eps, pmf)
    return ((pmf(q, eps) @ ((q.max() - q) ** 2)) - (e ** 2))
def variance(q, eps, pmf=em_pmf):
    e = expected_error(q, eps, pmf)
    return ((pmf(q, eps) @ ((q.max() - q) ** 2)) - (e ** 2))