<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/most-popular-learners-in-mlr/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://mlr-org.github.io/Most_Popular_Learners_in_mlr/"> mlr-org</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>For the development of <a target="_blank" rel="nofollow" href="https://github.com/mlr-org/mlr">mlr</a> as well as for an “machine learning expert” it can be handy to know what are the most popular learners used.<br>
Not necessarily to see, what are the top notch performing methods but to see what is used “out there” in the real world.<br>
Thanks to the nice little package <a target="_blank" rel="nofollow" href="https://github.com/metacran/cranlogs">cranlogs</a> from <a target="_blank" rel="nofollow" href="https://www.r-pkg.org/">metacran</a> you can at least get a slight estimate as I will show in the following…</p>
<p><span></span></p>
<p>First we need to install the <code>cranlogs</code> package using <code>devtools</code>:</p>
<figure>
<pre><code data-lang="r"><span>devtools</span><span>::</span><span>install_github</span><span>(</span><span>&quot;metacran/cranlogs&quot;</span><span>)</span></code></pre>
</figure>
<p>Now let’s load all the packages we will need:</p>
<figure>
<pre><code data-lang="r"><span>library</span><span>(</span><span>mlr</span><span>)</span><span>
</span><span>library</span><span>(</span><span>stringi</span><span>)</span><span>
</span><span>library</span><span>(</span><span>cranlogs</span><span>)</span><span>
</span><span>library</span><span>(</span><span>data.table</span><span>)</span></code></pre>
</figure>
<p>Do obtain a neat table of all available learners in <em>mlr</em> we can call <code>listLearners()</code>.<br>
This table also contains a column with the needed packages for each learner separated with a <code>,</code>.</p>
<figure>
<pre><code data-lang="r"><span># obtain used packages for all learners
</span><span>lrns</span><span> </span><span>=</span><span> </span><span>as.data.table</span><span>(</span><span>listLearners</span><span>())</span><span>
</span><span>all.pkgs</span><span> </span><span>=</span><span> </span><span>stri_split</span><span>(</span><span>lrns</span><span>$</span><span>package</span><span>,</span><span> </span><span>fixed</span><span> </span><span>=</span><span> </span><span>&quot;,&quot;</span><span>)</span></code></pre>
</figure>
<p><em>Note:</em> You might get some warnings here because you likely did not install all packages that <em>mlr</em> suggests – which is totally fine.</p>
<p>Now we can obtain the download counts from the <em>rstudio cran mirror</em>, i.e. from the last month.<br>
We use <code>data.table</code> to easily sum up the download counts of each day.</p>
<figure>
<pre><code data-lang="r"><span>all.downloads</span><span> </span><span>=</span><span> </span><span>cran_downloads</span><span>(</span><span>packages</span><span> </span><span>=</span><span> </span><span>unique</span><span>(</span><span>unlist</span><span>(</span><span>all.pkgs</span><span>)),</span><span> </span><span>when</span><span> </span><span>=</span><span> </span><span>&quot;last-month&quot;</span><span>)</span><span>
</span><span>all.downloads</span><span> </span><span>=</span><span> </span><span>as.data.table</span><span>(</span><span>all.downloads</span><span>)</span><span>
</span><span>monthly.downloads</span><span> </span><span>=</span><span> </span><span>all.downloads</span><span>[,</span><span> </span><span>list</span><span>(</span><span>monthly</span><span> </span><span>=</span><span> </span><span>sum</span><span>(</span><span>count</span><span>)),</span><span> </span><span>by</span><span> </span><span>=</span><span> </span><span>package</span><span>]</span></code></pre>
</figure>
<p>As some learners need multiple packages we will use the download count of the package with the least downloads.</p>
<figure>
<pre><code data-lang="r"><span>lrn.downloads</span><span> </span><span>=</span><span> </span><span>sapply</span><span>(</span><span>all.pkgs</span><span>,</span><span> </span><span>function</span><span>(</span><span>pkgs</span><span>)</span><span> </span><span>{</span><span>
</span><span>monthly.downloads</span><span>[</span><span>package</span><span> </span><span>%in%</span><span> </span><span>pkgs</span><span>,</span><span> </span><span>min</span><span>(</span><span>monthly</span><span>)]</span><span>
</span><span>})</span></code></pre>
</figure>
<p>Let’s put these numbers in our table:</p>
<figure>
<pre><code data-lang="r"><span>lrns</span><span>$</span><span>downloads</span><span> </span><span>=</span><span> </span><span>lrn.downloads</span><span>
</span><span>lrns</span><span> </span><span>=</span><span> </span><span>lrns</span><span>[</span><span>order</span><span>(</span><span>downloads</span><span>,</span><span> </span><span>decreasing</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>),]</span><span>
</span><span>lrns</span><span>[,</span><span> </span><span>.</span><span>(</span><span>class</span><span>,</span><span> </span><span>name</span><span>,</span><span> </span><span>package</span><span>,</span><span> </span><span>downloads</span><span>)]</span></code></pre>
</figure>
<p><em>Here are the first 5 rows of the table:</em></p>
<table>
<thead>
<tr>
<th>class</th>
<th>name</th>
<th>package</th>
<th>downloads</th>
</tr>
</thead>
<tbody>
<tr>
<td>surv.coxph</td>
<td>Cox Proportional Hazard Model</td>
<td>survival</td>
<td>153681</td>
</tr>
<tr>
<td>classif.naiveBayes</td>
<td>Naive Bayes</td>
<td>e1071</td>
<td>102249</td>
</tr>
<tr>
<td>classif.svm</td>
<td>Support Vector Machines (libsvm)</td>
<td>e1071</td>
<td>102249</td>
</tr>
<tr>
<td>regr.svm</td>
<td>Support Vector Machines (libsvm)</td>
<td>e1071</td>
<td>102249</td>
</tr>
<tr>
<td>classif.lda</td>
<td>Linear Discriminant Analysis</td>
<td>MASS</td>
<td>55852</td>
</tr>
</tbody>
</table>
<p>Now let’s get rid of the duplicates introduced by the distinction of the type <em>classif</em>, <em>regr</em> and we already have our…</p>
<h2>nearly final table</h2>
<figure>
<pre><code data-lang="r"><span>lrns.small</span><span> </span><span>=</span><span> </span><span>lrns</span><span>[,</span><span> </span><span>.SD</span><span>[</span><span>1</span><span>,],</span><span> </span><span>by</span><span> </span><span>=</span><span> </span><span>.</span><span>(</span><span>name</span><span>,</span><span> </span><span>package</span><span>)]</span><span>
</span><span>lrns.small</span><span>[,</span><span> </span><span>.</span><span>(</span><span>class</span><span>,</span><span> </span><span>name</span><span>,</span><span> </span><span>package</span><span>,</span><span> </span><span>downloads</span><span>)]</span></code></pre>
</figure>
<p>The top 20 according to the <em>rstudio cran mirror</em>:</p>
<table>
<thead>
<tr>
<th>class</th>
<th>name</th>
<th>package</th>
<th>downloads</th>
</tr>
</thead>
<tbody>
<tr>
<td>surv.coxph</td>
<td>Cox Proportional Hazard Model</td>
<td>survival</td>
<td>153681</td>
</tr>
<tr>
<td>classif.naiveBayes</td>
<td>Naive Bayes</td>
<td>e1071</td>
<td>102249</td>
</tr>
<tr>
<td>classif.svm</td>
<td>Support Vector Machines (libsvm)</td>
<td>e1071</td>
<td>102249</td>
</tr>
<tr>
<td>classif.lda</td>
<td>Linear Discriminant Analysis</td>
<td>MASS</td>
<td>55852</td>
</tr>
<tr>
<td>classif.qda</td>
<td>Quadratic Discriminant Analysis</td>
<td>MASS</td>
<td>55852</td>
</tr>
<tr>
<td>classif.randomForest</td>
<td>Random Forest</td>
<td>randomForest</td>
<td>52094</td>
</tr>
<tr>
<td>classif.gausspr</td>
<td>Gaussian Processes</td>
<td>kernlab</td>
<td>44812</td>
</tr>
<tr>
<td>classif.ksvm</td>
<td>Support Vector Machines</td>
<td>kernlab</td>
<td>44812</td>
</tr>
<tr>
<td>classif.lssvm</td>
<td>Least Squares Support Vector Machine</td>
<td>kernlab</td>
<td>44812</td>
</tr>
<tr>
<td>cluster.kkmeans</td>
<td>Kernel K-Means</td>
<td>kernlab</td>
<td>44812</td>
</tr>
<tr>
<td>regr.rvm</td>
<td>Relevance Vector Machine</td>
<td>kernlab</td>
<td>44812</td>
</tr>
<tr>
<td>classif.cvglmnet</td>
<td>GLM with Lasso or Elasticnet Regularization (Cross Validated Lambda)</td>
<td>glmnet</td>
<td>41179</td>
</tr>
<tr>
<td>classif.glmnet</td>
<td>GLM with Lasso or Elasticnet Regularization</td>
<td>glmnet</td>
<td>41179</td>
</tr>
<tr>
<td>surv.cvglmnet</td>
<td>GLM with Regularization (Cross Validated Lambda)</td>
<td>glmnet</td>
<td>41179</td>
</tr>
<tr>
<td>surv.glmnet</td>
<td>GLM with Regularization</td>
<td>glmnet</td>
<td>41179</td>
</tr>
<tr>
<td>classif.cforest</td>
<td>Random forest based on conditional inference trees</td>
<td>party</td>
<td>36492</td>
</tr>
<tr>
<td>classif.ctree</td>
<td>Conditional Inference Trees</td>
<td>party</td>
<td>36492</td>
</tr>
<tr>
<td>regr.cforest</td>
<td>Random Forest Based on Conditional Inference Trees</td>
<td>party</td>
<td>36492</td>
</tr>
<tr>
<td>regr.mob</td>
<td>Model-based Recursive Partitioning Yielding a Tree with Fitted Models Associated with each Terminal Node</td>
<td>party,modeltools</td>
<td>36492</td>
</tr>
<tr>
<td>surv.cforest</td>
<td>Random Forest based on Conditional Inference Trees</td>
<td>party,survival</td>
<td>36492</td>
</tr>
</tbody>
</table>
<p>As we are just looking for the packages let’s compress the table a bit further and come to our…</p>
<h2>final table</h2>
<figure>
<pre><code data-lang="r"><span>lrns</span><span>[,</span><span>list</span><span>(</span><span>learners</span><span> </span><span>=</span><span> </span><span>paste</span><span>(</span><span>class</span><span>,</span><span> </span><span>collapse</span><span> </span><span>=</span><span> </span><span>&quot;,&quot;</span><span>)),</span><span>by</span><span> </span><span>=</span><span> </span><span>.</span><span>(</span><span>package</span><span>,</span><span> </span><span>downloads</span><span>)]</span></code></pre>
</figure>
<p><em>Here are the first 20 rows of the table:</em></p>
<table>
<thead>
<tr>
<th>package</th>
<th>downloads</th>
<th>learners</th>
</tr>
</thead>
<tbody>
<tr>
<td>survival</td>
<td>153681</td>
<td>surv.coxph</td>
</tr>
<tr>
<td>e1071</td>
<td>102249</td>
<td>classif.naiveBayes, classif.svm, regr.svm</td>
</tr>
<tr>
<td>MASS</td>
<td>55852</td>
<td>classif.lda, classif.qda</td>
</tr>
<tr>
<td>randomForest</td>
<td>52094</td>
<td>classif.randomForest, regr.randomForest</td>
</tr>
<tr>
<td>kernlab</td>
<td>44812</td>
<td>classif.gausspr, classif.ksvm, classif.lssvm, cluster.kkmeans, regr.gausspr, regr.ksvm, regr.rvm</td>
</tr>
<tr>
<td>glmnet</td>
<td>41179</td>
<td>classif.cvglmnet, classif.glmnet, regr.cvglmnet, regr.glmnet, surv.cvglmnet, surv.glmnet</td>
</tr>
<tr>
<td>party</td>
<td>36492</td>
<td>classif.cforest, classif.ctree, multilabel.cforest, regr.cforest, regr.ctree</td>
</tr>
<tr>
<td>party,modeltools</td>
<td>36492</td>
<td>regr.mob</td>
</tr>
<tr>
<td>party,survival</td>
<td>36492</td>
<td>surv.cforest</td>
</tr>
<tr>
<td>fpc</td>
<td>33664</td>
<td>cluster.dbscan</td>
</tr>
<tr>
<td>rpart</td>
<td>28609</td>
<td>classif.rpart, regr.rpart, surv.rpart</td>
</tr>
<tr>
<td>RWeka</td>
<td>20583</td>
<td>classif.IBk, classif.J48, classif.JRip, classif.OneR, classif.PART, cluster.Cobweb, cluster.EM, cluster.FarthestFirst, cluster.SimpleKMeans, cluster.XMeans, regr.IBk</td>
</tr>
<tr>
<td>gbm</td>
<td>19554</td>
<td>classif.gbm, regr.gbm, surv.gbm</td>
</tr>
<tr>
<td>nnet</td>
<td>19538</td>
<td>classif.multinom, classif.nnet, regr.nnet</td>
</tr>
<tr>
<td>caret,pls</td>
<td>18106</td>
<td>classif.plsdaCaret</td>
</tr>
<tr>
<td>pls</td>
<td>18106</td>
<td>regr.pcr, regr.plsr</td>
</tr>
<tr>
<td>FNN</td>
<td>16107</td>
<td>classif.fnn, regr.fnn</td>
</tr>
<tr>
<td>earth</td>
<td>15824</td>
<td>regr.earth</td>
</tr>
<tr>
<td>neuralnet</td>
<td>15506</td>
<td>classif.neuralnet</td>
</tr>
<tr>
<td>class</td>
<td>14493</td>
<td>classif.knn, classif.lvq1</td>
</tr>
</tbody>
</table>
<h2>Remarks</h2>
<p>This is not really representative of how popular each learner is, as some packages have multiple purposes (e.g. multiple learners).<br>
Furthermore it would be great to have access to the <a target="_blank" rel="nofollow" href="https://www.r-pkg.org/trending">trending</a> list.<br>
Also <a target="_blank" rel="nofollow" href="https://www.r-pkg.org/starred"><em>most stars at GitHub</em></a> gives a better view of what the developers are interested in.<br>
Looking for machine learning packages we see there e.g: <a target="_blank" rel="nofollow" href="https://github.com/dmlc/xgboost">xgboost</a>, <a target="_blank" rel="nofollow" href="https://github.com/h2oai/h2o-3">h2o</a> and <a target="_blank" rel="nofollow" href="https://github.com/rstudio/tensorflow">tensorflow</a>.</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="https://mlr-org.github.io/Most_Popular_Learners_in_mlr/"> mlr-org</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/gZg8mjDTgrY"></a></div>