File:Chernoff-bound.svg
Summary
Description |
English: Chernoff bound (upper and lower) for the CDF of a chi-square random variable with ten degrees of freedom |
Date | |
Source | Own work |
Author | Nicoguaro |
SVG development | |
Source code | Python codefrom __future__ import division
import numpy as np
from scipy.special import gammaincc
import matplotlib.pyplot as plt
plt.style.use(u"seaborn-white")
def chifunc(x, n):
return gammaincc(n/2, x*n/2)
red = "#e41a1c"
blue = "#377eb8"
green = "#4daf4a"
M = 10
z = np.linspace(0.01, 10, 1000)
a = (1 - 2/(9*M))**3
nx = z <= a
nx2 = z >= a
chernoff = (z * np.exp(1 - z))**(M/2)
plt.figure(figsize=(5, 3))
plt.loglog(z[nx], 1 - chifunc(z[nx], M), color=red)
plt.loglog(z[nx2], chifunc(z[nx2], M), color=blue, linestyle="dashed")
plt.loglog(z, chernoff, color=green, linestyle="dotted")
plt.xlim(0.01, 10)
plt.ylim(1e-15, 10)
plt.yticks(np.logspace(-15, 0, 4))
plt.legend(["CDF", "1 - CDF", "Chernoff bound"], loc="best")
plt.xlabel(r"$z$", fontsize=15)
plt.savefig("Chernoff-bound.svg", bbox_inches="tight")
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.