# Validation variance derivation from the free “Learning From Data” course

Here is a derivation from the free "Learning From Data" course, lecture 13 on validation. Here is a link to it.

Now, I'm stuck figuring out how he developed the third lane, the one about the variance. I tried to develop it myself and got stuck.

Here is what I've been trying:

$E_{val}(h) = \dfrac{1}{k}(\Sigma(e(h(x_k),y)))$

this is just the definition of the error that the professor gave, and I understand it. It's on the end of the first line.

Then:

$var[E_val] = var[\dfrac{1}{k}(\Sigma(e(h(x_k),y)))]$

by the definition of variance:

$var[\dfrac{1}{k}(\Sigma(e(h(x_k),y)))] = E[(\dfrac{1}{k}(\Sigma(e(h(x_k),y))) - E[\dfrac{1}{k}(\Sigma(e(h(x_k),y)))])^2]$

after some playing with the algebra I came to this:

$E[(\dfrac{1}{k}(\Sigma(e(h(x_k),y))))^2]-E[\dfrac{1}{k}(\Sigma(e(h(x_k),y)))]^2$

As you can see, this is nothing like what he got. Will anyone explain this to me?

• Did the professor state a priori that the random variables $(x_k, y_k)$ are independent of each other? – Hans Nov 29 '17 at 20:06

$Var\left( \sum_ia_iX_i \right) = \sum_ia_i^2Var(X_i) + \sum_{i \neq j}a_ia_jCov(X_i,X_j)$
In case it's unclear, the $a_i$ above are all equal to $1/K$ in your case. The random variable $X_i$ is $e(h(x_i),y)$.