<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://mandakausthubh.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://mandakausthubh.github.io/" rel="alternate" type="text/html" /><updated>2026-08-27T14:38:14+00:00</updated><id>https://mandakausthubh.github.io/feed.xml</id><title type="html">Kausthubh</title><subtitle>Your Name&apos;s academic portfolio</subtitle><author><name>Kausthubh</name><email>manda.kausthubh@iiitb.ac.in</email></author><entry><title type="html">Hoeffding’s Inequality and Theory of Generalisation</title><link href="https://mandakausthubh.github.io/posts/2025/ProofOfHoeffding" rel="alternate" type="text/html" title="Hoeffding’s Inequality and Theory of Generalisation" /><published>2025-04-12T22:23:13+00:00</published><updated>2025-04-12T22:23:13+00:00</updated><id>https://mandakausthubh.github.io/posts/2025/blog-post-1</id><content type="html" xml:base="https://mandakausthubh.github.io/posts/2025/ProofOfHoeffding"><![CDATA[<p>This Hoeffding’s inequality is one of the most fundamental inequalities in Statistical Machine Learning. In this blog post we discuss the proof in this Blog.</p>

<h1 id="what-is-hoeffdings-inequality-">What is Hoeffding’s Inequality ?</h1>

<p>Given a sequence of Random Variables that act as I.I.Ds (Identical Independently Distributed) $Z_{1}, Z_{2}, Z_{3} \dots Z_{n}$ with mean $\mu$ and $\mathbf{P}(a \leq Z_{i} \leq b) = 1$ then for any $\epsilon &gt; 0$ we have the following:</p>

\[\mathbf{P}(|\bar{Z}_{n} - \mu| &gt; \epsilon) \leq \exp\left( \frac{-2n\epsilon^{2}}{(b-a)^{2}} \right)\]

<p>where $\bar{Z_{n}}=\frac{1}{n} \sum_{i=1}^{n}Z_{i}$.</p>

<p>Why should anyone care about this at all?? This is well explained in Abu Mostafa’s book: <strong>Learning from data: A Short Course</strong>. This is an excellent book for anyone to get started on theoretical machine learning and is a must read. This book was based on the course that he had taught at <strong>CalTech</strong>. Although this book doesn’t go into the actual proof of Hoeffding’s in-equality this blog aims of explaining Hoeffding’s inequality in a rigorous manner while also providing great intuition. <em>Most of this blog is originally taken from Stanford CS229: Supplemental Lecture notes: Hoeffding’s inequality, John Duchi. and CMU 36-705 Intermediate Statistics by Larry Wasserman.</em> I highly recommend that the readers go through their courses as they are stellar and are freely available on the internet.</p>

<p>One can interpret this as follows: the probability that the mean of the independent samples one collects from a distribution deviates from the mean of the original distribution with at tolerance $\epsilon$ is exponentially decreasing with the number of samples one collects $n$. This is very important thing for folk in machine learning and data science. This is one of the founding basis for the belief that: <em>More data gives better results</em>. We will see in the next few blogs how this plays into the idea of generalisation in Machine Learning Theory.</p>

<h2 id="proof-of-hoeffdings-inequality">Proof of Hoeffding’s inequality:</h2>

<p>In order to prove Hoeffding’s inequality we prove some other smaller theorems who consequence in what we require:</p>

<h3 id="check-point-1-markovs-inequality">Check Point 1: Markov’s inequality</h3>

<p>Let $Z \geq 0$ be a non-negative random variable. Then $\forall\ t&gt;0$ this
\(\mathbf{P}(Z \geq t) \leq \frac{\mathbf{E}[Z]}{t}\)
<strong>Proof:</strong> This is simple and probably familiar to most of you, but let’s go over this anyway:
\(\begin{aligned}
 \mathbf{P} (Z \geq t) &amp; = \int_{t}^{\infty} p(x)dx \\
 &amp; \leq \int_{t}^{\infty} p(x)dx \leq \int_{t}^{\infty} \frac{x}{t} p(x)dx \\ \\
 &amp; \leq \frac{1}{t} \int_{t}^{\infty} x p(x)dx \\ \\
 &amp; \leq \frac{1}{t}\int_{0}^{\infty} xp(x)dx = \frac{\mathbf{E}[Z]}{t}\\
\end{aligned}\)
Hence we have Markov’s: $\mathbf{P}(Z \geq t) \leq \frac{\mathbf{E}[Z]}{t}$</p>

<h3 id="check-point-2-chebyshevs-inequality">Check Point 2: Chebyshev’s Inequality</h3>
<p>Let $Z$ be a random variable with $\mathbf{Var}(Z)$ being finite. The for $t &gt; 0$ we have:
\(\mathbf{P}(|Z - \mathbf{E}[Z]| \geq \epsilon) &lt; \frac{\mathbf{Var}(Z)}{\epsilon^{2}}\)
The proof for this is a consequence of the previous Markov Inequality:
\(\begin{aligned}
\mathbf{P}(|Z - \mathbf{E}(Z)| \geq \epsilon)  &amp; = \mathbf{P} ((Z - \mathbf{E}[Z])^{2} \geq \epsilon^{2}) \\
 &amp; \leq \frac{\mathbf{E} [(Z-E[Z])^{2}]}{\epsilon^{2}} = \frac{\mathbf{Var(Z)}}{\epsilon^{2}}
\end{aligned}\)
Hence we have the following: $\mathbf{P}(|Z - \mathbf{E}[Z]| \geq \epsilon) &lt; \frac{\mathbf{Var}(Z)}{\epsilon^{2}}$. You need to note this strategy which works based on derivations of Markov’s Inequality. Works wary well and proves a lot of great things.</p>

\[\mathbf{P}(|Z-\mathbf{E}(Z)| \geq \epsilon) = \mathbf{P}(|Z-\mathbf{E}(Z)|^k \geq \epsilon^k) &lt; \frac{\mathbf{E}(|Z-\mathbf{E}(Z)|^k)}{\epsilon^k}\]

<p>Some further observations from this is: When ever we have $Z_{1}, Z_{2}, Z_{3}\dots Z_{n}$ are I.I.Ds with $\mathbf{E}[Z_{i}]=0$ we have the following:
\(\mathbf{Var} (\bar{Z}) = \frac{1}{n}\sum_{i,j\leq n}\mathbf{E}[Z_{i}Z_{j}]\)
Proof of this is:
\(\begin{aligned}
 \sum_{i,j \leq n} \mathbf{E}[Z_{i} Z_{j}] &amp;= \sum_{i=1}^{n} \mathbf{E}[Z_{i}^{2}] + \sum_{i \neq j} \mathbf{E}[Z_{i} Z_{j}]  \\
 &amp; =  \sum_{i=1}^{n} \mathbf{E}[Z_{i}^{2}] + \sum_{i \neq j} \mathbf{E}[Z_{i}].\mathbf{E}[Z_{j}] = \sum_{i=1}^{n} \mathbf{E}[Z_{i}^{2}] + \sum_{i \neq j} (\mathbf{E}[Z_{i}])^{2}  \\
 &amp; =n\mathbf{E}[Z_{i}^{2}] + n(n-1)\mathbf{E}[Z]^{2}
\\ 
 &amp; = n.\mathbf{E}(Z_{i}^{2})
\end{aligned}\)
This gives us:
\(\mathbf{E} (Z_{i}^{2}) = \mathbf{Var}(Z_{i}) = \frac{1}{n} \sum_{i,j} \mathbf{E}[Z_{i} Z_{j}]\)
Now using Chebyshev’s inequality on this result we get:
\(\mathbf{P}(|\bar{Z}| \geq \epsilon) \leq \frac{\mathbf{Var}(Z_{i})}{\epsilon^{2}} = \frac{1}{n\epsilon^{2}} \sum_{i, j} \mathbf{E}[Z_{i}Z_{j}]\)
We will come back to these results back again.</p>

<h3 id="check-point-3-moment-generating-functions-and-chernoff-bounds">Check Point 3: Moment Generating Functions and Chernoff Bounds</h3>
<p>Given a random variable $Z$, the corresponding M.G.F is:
\(M_{Z}(\lambda) = \mathbf{E}[\exp(\lambda Z)]\)
The <strong>Chernoff bound</strong> is a statistical bound stated as follows, given a random variable we have:
\(\mathbf{P}(|Z - \mathbf{E}[Z]| \geq \epsilon) \leq \min_{\lambda\geq {0}} \mathbf{E}[\exp(\ \lambda\ |Z - \mathbf{E}[Z]|)] e^{-\lambda\epsilon} = \min_ M_{|Z - \mathbf{E}[Z]|}(\lambda) e^{-\lambda t}\)
Proof for the same is, using Markov’s inequality (same trick again … see it’s pretty useful):
\(\begin{aligned}
\mathbf{P} (|Z - \mathbf{E}[Z]| \geq \epsilon)  &amp; = \mathbf{P} (\exp(\lambda|Z-\mathbf{E}[Z]|) \geq e^{\lambda \epsilon}) \\
 &amp; \leq \mathbf{E}[\exp(\lambda|Z- \mathbf{E}[Z]|)].e^{-\lambda\epsilon} 
\end{aligned}\)
Since this is true for all $\lambda &gt; 0$, we can replace this with a minima over varying positive $\lambda’s$. 
\(\mathbf{P}(|Z - \mathbf{E}[Z]| \geq \epsilon) \leq \min_{\lambda} = \min_ \mathbf{E}[\exp(\lambda|Z- \mathbf{E}[Z]|)].e^{-\lambda\epsilon} = \min_{\lambda &gt; 0} M_{|Z - \mathbf{E}[Z]|}(\lambda) e^{-\lambda t}\)
This is the chernoff bound. The reason we care about this is that it plays well with summations over Independent distributions, which is a consequence of moment generating functions. We get the following results:
\(M_{Z_{1} + Z_{2} +\dots +Z_{n}}(\lambda) = \prod_{i=1}^{n} M_{Z_{i}}(\lambda)\)
It’s useful to see that from this we will have:
\(\begin{aligned}
\mathbf{P}(|\bar{Z_{i}} - \mu| &gt; \epsilon)  &amp;= P\left( \left|\sum_{i=1}^{n} Z_{i} - n\mu\right| &gt; n\epsilon  \right) \\
&amp;=P\left(\exp\left(t.\left|\sum_{i=1}^{n} Z_{i} - n\mu\right|\right) &gt; \exp(nt\epsilon)\right) \\
\implies \mathbf{P}(|\bar{Z_{i}} - \mu| &gt; \epsilon) &amp;\leq \exp(-tn\epsilon) \prod_{i=1}^{n}M_{|Z_{i}-\mu|}(t) \\
 &amp;= \exp(-tn\epsilon) (M_{|Z_{i}-\mu|}(t))^n
\end{aligned}\)</p>

<h3 id="small-helper-function">Small Helper Function:</h3>

<p>There is one final inequality we use to prove Hoeffding’s inequality: Suppose that we have a random variable $Z$, which is bounded, i.e., $Z \in [a,b]$, with mean $\mu$:
\(\mathbf{E}(e^{tX}) \leq e^{t\mu} \exp\left( \frac{t^2 (b-a)^2 }{8} \right)\)
The link to this proof is in a different blog entry:</p>

<h3 id="final-step-hoeffdings-inequality">Final Step: Hoeffding’s Inequality!!</h3>

<p>The true form of Hoeffding’s Inequality is not as we mentioned!! The original statement actually only speaks about the <em>Independent Variables</em> but not <em>I.I.Ds</em>, this is because <em>I.I.D</em>s are just are just one version of <em>Independent Variables</em>. The true statement is:</p>

<p>Here’s the final proof of <strong>Hoeffding’s Inequality</strong>, alas: Suppose we have independent random variables $Z_{1}, Z_{2}\dots Zn$ such that each one of them is bounded, i.e., $Z_{i} \in [a_{i}, b_{i}]$:
\(\begin{aligned}
\mathbf{P}(\bar{Z}_{n} &gt; \epsilon) &amp;\leq e^{-nt \epsilon} \mathbf{E}\left( \exp\left( t \sum_{i=1}^{n} Z_{i}  \right) \right)\\
&amp;\leq e^{-nt\epsilon} \prod_{i=1}^{n} \mathbf{E}(\exp(tZ_{i})) \\
&amp;\leq e^{-nt\epsilon} \prod_{i=1}^{n} \exp\left( nt\mu + \frac{t^2(b-a)^2}{8} \right)
\end{aligned}\)
This is essentially Hoeffding’s inequality. The more familiar version of this is when we have $Z_i$s are all identical, aka, they are iids.
\(\mathbf{P}(\bar{Y}_{n} &gt; \epsilon) \leq \inf_{t\geq 0} \exp\left( -n\epsilon t + nt\mu+\frac{nt^2(b-a)^2}{8} \right)\)
The minima for this occurs when $t = \frac{4\epsilon}{(b-a)^2}$. Hence we have: (when taken with absolute value $\mu$ becomes 0)
\(\mathbf{P}(|\bar{Y}_{n}-\mu| &gt; \epsilon) \leq 2 \exp\left( \frac{-2n\epsilon^2}{(b-a)^2} \right)\)</p>]]></content><author><name>Kausthubh</name><email>manda.kausthubh@iiitb.ac.in</email></author><category term="Generalisation Theory" /><category term="Statistical ML" /><summary type="html"><![CDATA[This Hoeffding’s inequality is one of the most fundamental inequalities in Statistical Machine Learning. In this blog post we discuss the proof in this Blog.]]></summary></entry></feed>