<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/r-code-to-accompany-real-world-machine-learning-chapters-2-4-updates/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://feedproxy.google.com/~r/DataProne-R/~3/-mcfn1WsWYs/real-world-machine-learning-with-R-chapters-2-3-4-updates.html"> data prone - R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h2>Abstract</h2>
<p>I updated the R code to accompany Chapter 2-4 of the book “Real-World Machine Learning” by Henrik Brink, Joseph W. Richards, and Mark Fetherolf to be more consistent with the listings and figures as presented in the book.</p>
<h2>rwml-R Chapters 2-4 updated</h2>
<p>The most notable changes to <a target="_blank" rel="nofollow" href="https://padamson.github.io/rwml-R/">rwml-R</a> are for <a target="_blank" rel="nofollow" href="https://padamson.github.io/rwml-R/Chapter4.html">Chapter 4</a>, where<br>
multiple ROC curves are<br>
plotted for a 10-class classifier and a tile plot is generated for<br>
a tuning parameter grid search.<br>
Also, for parallel computations, the <a target="_blank" rel="nofollow" href="https://cran.r-project.org/web/packages/doMC/index.html"><code>doMC</code></a> package was replaced with<br>
<a target="_blank" rel="nofollow" href="https://cran.r-project.org/web/packages/doParallel/index.html"><code>doParallel</code></a>.</p>
<h2>Plotting a series of ROC curves</h2>
<p>To be consistent with the approach followed in the book, I’ve added listings<br>
of R code to compute the<br>
ROC curves and AUC values “from scratch” instead of using the <code>ROCR</code><br>
package as was done previously:</p>
<p></p>
<h2>Tuning model parameters in Chapter 4</h2>
<p>The <a target="_blank" rel="nofollow" href="http://topepo.github.io/caret/"><code>caret</code></a> package is used to tune parameters via grid search<br>
for the Support Vector Machines model with a Radial Basis Function Kernel.<br>
By setting <code>summaryFunction = twoClassSummary</code><br>
in <code>trainControl</code>, the <code>ROC</code> curve is used to select the optimal<br>
model. For consistency with the book, tile plots were added to illustrate the<br>
process of refining<br>
the grid for the parameter search. The tile plot for the second (refined)<br>
grid search is below.</p>
<p><img alt="Tile plot for parameter search" src="https://i0.wp.com/padamson.github.io/assets/figure4.25sub2-1.png?w=456" data-recalc-dims="1"></p>
<h2>Feedback welcome</h2>
<p>If you have any feedback on the <a target="_blank" rel="nofollow" href="https://padamson.github.io/rwml-R/">rwml-R</a> project, please<br>
leave a comment below or use the Tweet button.<br>
As with any of my projects, feel free to <a target="_blank" rel="nofollow" href="https://github.com/padamson/rwml-R/fork">fork the rwml-R repo</a><br>
and submit a pull request if you wish to contribute.<br>
For convenience, I’ve created a <a target="_blank" rel="nofollow" href="https://padamson.github.io/rwml-R/">project page for rwml-R</a> with<br>
the generated HTML files from <code>knitr</code>.</p>
<p><a data-style="mega" target="_blank" rel="nofollow" href="https://github.com/padamson/rwml-R/archive/master.zip" data-icon="octicon-cloud-download">Download</a><br>
<a data-style="mega" data-count-href="http://feedproxy.google.com/padamson/rwml-R/network" data-count-aria-label="# forks on GitHub" target="_blank" data-count-api="/repos/padamson/rwml-R#forks_count" rel="nofollow" href="https://github.com/padamson/rwml-R/fork" data-icon="octicon-repo-forked">Fork</a></p>
<p><img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/DataProne-R/~4/-mcfn1WsWYs"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://feedproxy.google.com/~r/DataProne-R/~3/-mcfn1WsWYs/real-world-machine-learning-with-R-chapters-2-3-4-updates.html"> data prone - R</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/z9W-SrWsiJs"></a></div>