Skip to content

Commit

Permalink
Fixing a error in a formula
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalab committed Oct 6, 2022
1 parent 2bb7824 commit f2835c8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/cross-validation.html
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ <h2><span class="header-section-number">29.3</span> K-fold cross validation<a hr
<p><img src="ml/img/cv-5.png" width="70%" style="display: block; margin: auto;" /></p>
<p>Now we repeat the calculation above for each of these sets <span class="math inline">\(b=1,\dots,K\)</span> and obtain <span class="math inline">\(\hat{\mbox{MSE}}_1(\lambda),\dots, \hat{\mbox{MSE}}_K(\lambda)\)</span>. Then, for our final estimate, we compute the average:</p>
<p><span class="math display">\[
\hat{\mbox{MSE}}(\lambda) = \frac{1}{B} \sum_{b=1}^K \hat{\mbox{MSE}}_b(\lambda)
\hat{\mbox{MSE}}(\lambda) = \frac{1}{K} \sum_{b=1}^K \hat{\mbox{MSE}}_b(\lambda)
\]</span></p>
<p>and obtain an estimate of our loss. A final step would be to select the <span class="math inline">\(\lambda\)</span> that minimizes the MSE.</p>
<p>We have described how to use cross validation to optimize parameters. However, we now have to take into account the fact that the optimization occurred on the training data and therefore we need an estimate of our final algorithm based on data that was not used to optimize the choice. Here is where we use the test set we separated early on:</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ <h1>Preface<a href="index.html#preface" class="anchor-section" aria-label="Ancho
<p>This book was published with <a href="https://github.com/rstudio/bookdown">bookdown</a>. The <strong>R markdown code</strong> used to generate the book is available on <a href="https://github.com/rafalab/dsbook">GitHub</a><!--^[https://github.com/rafalab/dsbook]-->. Note that, the graphical theme used for plots throughout the book can be recreated using the <code>ds_theme_set()</code> function from <strong>dslabs</strong> package.</p>
<p>This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International <a href="https://creativecommons.org/licenses/by-nc-sa/4.0">CC BY-NC-SA 4.0</a>.</p>
<p>We make announcements related to the book on Twitter. For updates follow <a href="https://twitter.com/rafalab">@rafalab</a>.</p>
<p>Last update: 2022-10-04 17:21:36</p>
<p>Last update: 2022-10-06 15:05:13</p>
</div>
</section>

Expand Down
2 changes: 1 addition & 1 deletion docs/search_index.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ml/cross-validation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ knitr::include_graphics("ml/img/cv-5.png")
Now we repeat the calculation above for each of these sets $b=1,\dots,K$ and obtain $\hat{\mbox{MSE}}_1(\lambda),\dots, \hat{\mbox{MSE}}_K(\lambda)$. Then, for our final estimate, we compute the average:

$$
\hat{\mbox{MSE}}(\lambda) = \frac{1}{B} \sum_{b=1}^K \hat{\mbox{MSE}}_b(\lambda)
\hat{\mbox{MSE}}(\lambda) = \frac{1}{K} \sum_{b=1}^K \hat{\mbox{MSE}}_b(\lambda)
$$

and obtain an estimate of our loss. A final step would be to select the $\lambda$ that minimizes the MSE.
Expand Down

0 comments on commit f2835c8

Please sign in to comment.