File:Chernoff-bound.svg

From testwiki
Jump to navigation Jump to search

Original file(SVG file, nominally 410 × 268 pixels, file size: 41 KB)

This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

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
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
Source code
InfoField

Python code

from __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:
w:en:Creative Commons
attribution
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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

4 May 2017

image/svg+xml

dcf53c9b891a31ea0b1cede8756a4902e00ce91f

42,191 byte

268 pixel

410 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current22:10, 4 May 2017Thumbnail for version as of 22:10, 4 May 2017410 × 268 (41 KB)wikimediacommons>NicoguaroUser created page with UploadWizard

The following page uses this file: