Skip to content

Commit

Permalink
add faster solution to sol_advriskmin_1 (b)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandylaker committed Oct 23, 2024
1 parent d17194a commit 97c8156
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 1 deletion.
Binary file modified exercises-pdf/ex_advriskmin_1.pdf
Binary file not shown.
Binary file modified exercises-pdf/ex_advriskmin_2.pdf
Binary file not shown.
Binary file modified exercises-pdf/ex_advriskmin_3.pdf
Binary file not shown.
Binary file modified exercises-pdf/ic_advriskmin_1.pdf
Binary file not shown.
Binary file modified exercises-pdf/ic_sol_advriskmin_1.pdf
Binary file not shown.
Binary file modified exercises-pdf/sol_advriskmin_1.pdf
Binary file not shown.
Binary file modified exercises-pdf/sol_advriskmin_2.pdf
Binary file not shown.
Binary file modified exercises-pdf/sol_advriskmin_3.pdf
Binary file not shown.
29 changes: 28 additions & 1 deletion exercises/advriskmin/ex_rnw/sol_generalized_l2_loss.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,34 @@ $$\fxh = m^{-1}\left( \frac1n \sum_{i=1}^n m(\yi) \right)$$
is the optimal constant model for $L$.
%

\item First, note that
\item \textbf{Recommended solution:}
We need to use the fact that $y,y^{(1)},\ldots,y^{(n)}$ are i.i.d. and the arithmetric mean is an unbiased estimator. That being said,
\begin{align*}
\E_{xy}[m(y)] - \E_{xy}\left[\frac{1}{n} \sum_{i=1}^n m(\yi)\right] = 0.
\end{align*}

Therefore,

\begin{align*}
%
\risk_L\left(\fh \right)
&= \E_{xy} [\Lxy] \\
&= \E_{xy} [ \big(m(y)-m(\fxh)\big)^2 ] \\
&= \E_{xy} \left[ \left( m(y) - \frac1n \sum_{i=1}^n m(\yi) \right)^2 \right] \\
&= \E_{xy} \left[ \left( m(y) - \frac{1}{n} \sum_{i=1}^n m(\yi) - \left( \E_{xy}[m(y)] - \E_{xy}\left[\frac{1}{n} \sum_{i=1}^n m(\yi)\right] \right) \right)^2 \right] \\
&= \E_{xy} \left[ \left( m(y) - \frac{1}{n} \sum_{i=1}^n m(\yi) - \E_{xy}\left[m(y) - \frac{1}{n} \sum_{i=1}^n m(\yi)\right] \right)^2 \right] \\
&= \var\left( m(y) - \frac{1}{n} \sum_{i=1}^n m(\yi) \right) \\
&= \var(m(y)) + \var\left(\frac{1}{n} \sum_{i=1}^n m(\yi) \right) \\
&= \var(m(y)) + \frac{1}{n^2}\var(\sum_{i=1}^n m(\yi)) \\
&= \var(m(y)) + \frac{1}{n^2} \cdot n \var(m(\yi)) \\
&= \var(m(y)) + \frac{1}{n^2} \cdot n \var(m(y)) \\
&= \left(1 + \frac{1}{n} \right) \var(m(y)) \\
\end{align*}


\textbf{Alternative solution:}

Here we provide an alternative solution to (b). First, note that
%
\begin{align*}
%
Expand Down
Binary file modified exercises/advriskmin/figure/unnamed-chunk-2-1.pdf
Binary file not shown.
Binary file modified exercises/advriskmin/figure/unnamed-chunk-2-2.pdf
Binary file not shown.

0 comments on commit 97c8156

Please sign in to comment.