<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/ml-models-what-they-cant-learn/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://smarterpoland.pl/index.php/2018/05/ml-models-what-they-cant-learn/"> English – SmarterPoland.pl</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>What I love in conferences are the people, that come after your talk and say: <i>It would be cool to add XYZ to your package/method/theorem</i>.</p>
<p>After the <a rel="nofollow" href="https://2018.erum.io/" target="_blank">eRum</a> (great conference by the way) I was lucky to hear from Tal Galili: <i>It would be cool to use DALEX for teaching, to show how different ML models are learning relations</i>.</p>
<p>Cool idea. So let’s see what can and what cannot be learned by the most popular ML models. Here we will compare random forest against linear models against SVMs.<br>
Find the full example <a rel="nofollow" href="https://rawgit.com/pbiecek/DALEX_docs/master/vignettes/DALEX_teaching.html" target="_blank">here</a>. We simulate variables from uniform U[0,1] distribution and calculate y from following equation</p>
<p><center><img src="https://i0.wp.com/smarterpoland.pl/wp-content/uploads/2018/05/ex.png?w=450" data-recalc-dims="1"></center></p>
<p>In all figures below we compare PDP model responses against the true relation between variable x and the target variable y (pink color). All these plots are created with <a rel="nofollow" href="https://github.com/pbiecek/DALEX" target="_blank">DALEX</a> package.</p>
<p>For x1 we can check how different models deal with a quadratic relation. The linear model fails without prior feature engineering, random forest is guessing the shape but the best fit if found by SVMs.</p>
<p><img src="https://i0.wp.com/smarterpoland.pl/wp-content/uploads/2018/05/x1.png?w=456" data-recalc-dims="1"></p>
<p>With sinus-like oscillations the story is different. SVMs are not that flexible while random forest is much closer.</p>
<p><img src="https://i1.wp.com/smarterpoland.pl/wp-content/uploads/2018/05/x2.png?w=456" data-recalc-dims="1"></p>
<p>Turns out that monotonic relations are not easy for these models. The random forest is close but event here we cannot guarantee the monotonicity.</p>
<p><img src="https://i1.wp.com/smarterpoland.pl/wp-content/uploads/2018/05/x3.png?w=456" data-recalc-dims="1"></p>
<p>The linear model is the best one when it comes to truly linear relation. But other models are not that far.</p>
<p><img src="https://i2.wp.com/smarterpoland.pl/wp-content/uploads/2018/05/x4.png?w=456" data-recalc-dims="1"></p>
<p>The abs(x) is not an easy case for neither model.</p>
<p><img src="https://i1.wp.com/smarterpoland.pl/wp-content/uploads/2018/05/x5.png?w=456" data-recalc-dims="1"></p>
<p><a rel="nofollow" href="https://rawgit.com/pbiecek/DALEX_docs/master/vignettes/DALEX_teaching.html" target="_blank">Find the R codes here.</a></p>
<p>Of course the behavior of all these models depend on number of observation, noise to signal ratio, correlation among variables and interactions.<br>
Yet is may be educational to use PDP curves to see how different models are learning relations. What they can grasp easily and what they cannot.</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://smarterpoland.pl/index.php/2018/05/ml-models-what-they-cant-learn/"> English – SmarterPoland.pl</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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/KyhPuHGMTfk" height="1"></a></div>