<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/y-aware-scaling-in-context/"></div></div><div><a data-url="http://www.r-bloggers.com/y-aware-scaling-in-context/" data-counturl="http://www.r-bloggers.com/y-aware-scaling-in-context/" data-count="horizontal" data-text="y-aware scaling in context" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://www.win-vector.com/blog/2016/06/y-aware-scaling-in-context/"> R – Win-Vector Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Nina Zumel introduced <em>y</em>-aware scaling in her recent article <a target="_blank" href="http://www.win-vector.com/blog/2016/05/pcr_part2_yaware/">Principal Components Regression, Pt. 2: Y-Aware Methods</a>. I really encourage you to read the article and add the technique to your repertoire. The method combines well with other methods and can drive better predictive modeling results.</p>
<p>From feedback I am not sure everybody noticed that in addition to being easy and effective, the method is actually novel (we haven’t yet found an academic reference to it or seen it already in use after visiting numerous clients). Likely it has been applied before (as it is a simple method), but it is not currently considered a standard method (something we would like to change).</p>
<p>In this note I’ll discuss some of the context of <em>y</em>-aware scaling.<span></span></p>
<p><em>y</em>-aware scaling is a transform that has been available in as <a target="_blank" href="http://winvector.github.io/vtreathtml/vtreatScaleMode.html">“scale mode”</a> in the <a target="_blank" href="https://github.com/WinVector/vtreat">vtreat</a> <a target="_blank" href="https://cran.r-project.org/">R</a> package since prior to the first public release Aug 7, 2014 (derived from earlier proprietary work). It was always motivated by a “dimensional analysis” or “get the units consistent” argument. It is intended as the pre-processing step before operations that are metric sensitive, such as KNN classification and principal components regression. We didn’t really work on proving theorems about it, because in certain contexts it can be recognized as “the right thing to do.” It derives from considering input (or independent variables or columns) as single variable models and the combining of such variables as a <a target="_blank" href="http://www.win-vector.com/blog/2016/04/on-nested-models/">nested model</a> or <a target="_blank" href="https://en.wikipedia.org/wiki/Ensemble_learning">ensemble model</a> construction (chapter 6 of <a target="_blank" href="http://www.practicaldatascience.com/"><em>Practical Data Science with R</em> Nina Zumel, John Mount; Manning 2014</a> was somewhat organized with this idea behind the scenes). Considering <em>y</em> (or the outcome to be modeled) during dimension reduction prior to predictive modeling is a natural concern, but it seems to be anathema in principal components analysis.</p>
<p><em>y</em>-aware scaling is in fact simple (it involves multiplying by the slope coefficients from linear regressions for a regression problem or <a target="_blank" href="https://github.com/WinVector/Examples/blob/master/PCR/YAwarePCAclassification.md">multiplying by the slope coefficient from a logistic regression for classification problems</a>; this is different than multiplying by the outcome <em>y</em> which would not be available during the application phase of a predictive model). The fact that it is simple makes it a bit hard to accept that it is both effective and novel. We are not saying it is unprecedented, but it is certainly not center in the standard literature (despite being an easy and effective technique).</p>
<p>There is an an extensive literature on scaling, filtering, transforming, and pre-conditioning data for principal components analysis (for example see <a target="_blank" href="http://bmcgenomics.biomedcentral.com/articles/10.1186/1471-2164-7-142">“Centering, scaling, and transformations: improving the biological information content of metabolomics data”, Robert A van den BergEmail, Huub CJ Hoefsloot, Johan A Westerhuis, Age K Smilde and Mariët J van der Werf, BMC Genomics20067:142, 2006</a>). However, these are all what we call <em>x</em>-only transforms.</p>
<p>When you consult references (such as <em>The Elements of Statistical Learning</em>, 2nd edition, Trevor Hastie, Robert Tibshirani, Jerome Friedman, Springer 2009; and <em>Applied Predictive Modeling</em>, Max Kuhn, Kjell Johnson, Springer 2013) you basically see only two y-sensitive principal components style techniques (in addition to recommendations to use <a target="_blank" href="https://en.wikipedia.org/wiki/Regularization_(mathematics)">regularized</a> regression):</p>
<ul>
<li><a target="_blank" href="https://web.stanford.edu/~hastie/Papers/spca_JASA.pdf">Supervised PCA</a></li>
<li><a target="_blank" href="https://en.wikipedia.org/wiki/Partial_least_squares_regression">Partial Least Squares Regression</a></li>
</ul>
<p>I would like to repeat (it is already implied in Nina’s article): <em>y</em>-aware scaling is not equivalent to either of these methods.</p>
<p>Supervised PCA is simply pruning the variables by inspecting small regressions prior to the PCA steps. In my mind it makes our point that principal components users do not consider using the outcome or y-variable in their data preparation that in 2006 you could get a publication by encouraging this natural step and giving the step a name. I’ll repeat: filtering and pruning variables is common in many forms of data analysis so it is remarkable how much work was required to sell the idea of supervised PCA.</p>
<p>Partial Least Squares Regression is an interesting y-aware technique, but it is a different (and more complicated) technique than <em>y</em>-aware scaling. Here is an example (in R) showing the two methods having very different performance on (an admittedly artificial) problem: <a target="_blank" href="https://github.com/WinVector/Examples/blob/master/PCR/PLS.md">PLS.md</a>.</p>
<p>In conclusion, I encourage you to take the time to read up on <em>y</em>-aware scaling and consider using it during your dimension reduction steps prior to predictive modeling.</p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/y-aware-scaling-in-context/"></div></div><div><a data-url="http://www.r-bloggers.com/y-aware-scaling-in-context/" data-counturl="http://www.r-bloggers.com/y-aware-scaling-in-context/" data-count="vertical" data-text="y-aware scaling in context" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://www.win-vector.com/blog/2016/06/y-aware-scaling-in-context/"> R – Win-Vector Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://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="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/Kd9kAxCRxOg"></a></div>