<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://siyuangao.com/feed.xml" rel="self" type="application/atom+xml"/><link href="https://siyuangao.com/" rel="alternate" type="text/html" hreflang="en"/><updated>2026-06-12T11:41:12+00:00</updated><id>https://siyuangao.com/feed.xml</id><title type="html">blank</title><subtitle>Siyuan Gao&apos;s personal website. Research Engineer at Meta. PhD from Yale University. </subtitle><entry><title type="html">Notes on correlation</title><link href="https://siyuangao.com/blog/2018/notes-on-correlation/" rel="alternate" type="text/html" title="Notes on correlation"/><published>2018-08-03T00:00:00+00:00</published><updated>2018-08-03T00:00:00+00:00</updated><id>https://siyuangao.com/blog/2018/notes-on-correlation</id><content type="html" xml:base="https://siyuangao.com/blog/2018/notes-on-correlation/"><![CDATA[<h2 id="terms">Terms</h2> <p>Pearson correlation coefficient, coefficient of determination</p> <p><strong>Pearson correlation coefficient</strong> For a population</p> \[{\rho _{X,Y}={\frac {cov (X,Y)}{\sigma _{X}\sigma _{Y}}}}\] <p>For a sample</p> \[\rho _{X,Y}={\frac {E [(X-\mu _{X})(Y-\mu _{Y})]}{\sigma _{X}\sigma _{Y}}}\] <p><strong>coefficient of determination (\(R^2\))</strong></p> <blockquote> <p>Definition: the proportion of the variance in the dependent variable that is predictable from the independent variable(s).</p> </blockquote> \[R^{2}\equiv 1-{SS_{\rm {res}} \over SS_{\rm {tot}}}\] <p>When we test the models performance, \(R^2\) measures the size of the residuals from the model compared to the size of the residuals from a null model (mean value). On the training data, as the model cannot be worse than the null model, \(R^2\) will always be positive. It may not be the case for the testing data as the model can do worse than the null model.</p> <h2 id="some-notes">some notes</h2> <p>Things above are some basics that we all know. However, recently colleagues of mine proposes that our traditional approach of evaluating our prediction model’s performance is problematic.</p> <p>Previously, when we want to evaluate our model, we will first use cross-validation to generate predicted values and then calculate its Pearson correlation (\(r\)) between predicted vs observed values. However, when we do this, \(r\) reports the degree to which the predictions are <em>correlated</em> with observations, this is not the same as \(R^2\) where it represents the <em>accuracy</em> of the model.</p> <p>In the training set, when we regress observations (\(\bar{y}\)) on the predicted values (\(\hat{y}\)), the model will simply be \(y=\hat{y}\) as the regression model already assures to minimize residual sum of squares (SSR) and \(\hat{y}\) is already the linear combination of predictors. So there is no additional <em>fitting</em> when we evaluate the model on training data. \(r\) will just be the square root of \(R^2\).</p> <p>However, in the testing data, when we calculate \(r\), we are actually fitting a secondary model \(y=a+b\hat{y}\), and this will result in a higher \(R^2\) than we can get from directly apply the definition equation of \(R^2\). Some test set observations have gone to the secondary model which inflates the result. So reporting this secondary \(R^2\) may not give you what you think you want.</p> <p>All of this is tricky and if we want to say that \(R^2\) is the explained variance of the model, we have to make sure that “the model” is the one we trained, not the nontrivial secondary model.</p>]]></content><author><name></name></author><category term="statistics"/><summary type="html"><![CDATA[Pearson's r, coefficient of determination, and how to interpret them]]></summary></entry><entry><title type="html">civic si 体验总结</title><link href="https://siyuangao.com/blog/2018/si/" rel="alternate" type="text/html" title="civic si 体验总结"/><published>2018-07-26T00:00:00+00:00</published><updated>2018-07-26T00:00:00+00:00</updated><id>https://siyuangao.com/blog/2018/si</id><content type="html" xml:base="https://siyuangao.com/blog/2018/si/"><![CDATA[<p>自从今年二月份购入这辆tenth generation civic si已经过去将近半年了，是时候写一写自己半年来对于这辆车的体会了，一来可以让自己更好的回头重新认识这辆车，二来也是记录一下自己年少时的第一辆小钢炮。</p> <p>在买这辆civic si之前其实我已经开了一年的civic hatchback，但是因为一次他人的过错，那辆hatchback报废在了我家门口，本着“本田大法好”的信仰，我毫不犹豫地又购入了这辆更加心仪的si，目前来看，我并不后悔这个决定。</p> <p><img src="/assets/img/in-post/15319693174453/20180612-GSY_4934.jpg" alt="20180612-GSY_4934"/> @ East rock park, sunset</p> <h3 id="外观内饰">外观内饰</h3> <p>在买第一辆车之前，我算是一个80%的外观党，尽管一直有关注各种汽车方面的咨询，但是毕竟买车前也只有500km的驾驶经验，要我真的因为某些看起来虚无缥缈的“驾驶体验”来买车还是很难的，所以我能判断的也就是像外观内饰这样的比较简单就可以确定个人偏好的东西。而这辆si，我对他的外观可以给9分了，如果考虑到价格，那绝对是同级别里我心中的9.9分，10分留给gti。 但是内饰，不好意思，只能给到6分，而且这6分有很大程度是因为这个包裹性不错而且印有红色si logo的座椅。其他部分，infotainment system, 嵌有carplay，所以在娱乐方面还是不错，但是自带的honda系统真的丑+难用。反人类的音量调节触摸滑条再一次印证了“不要轻易在低端车上使用先进硬件”的真理。而且把空调调节功能也集合在娱乐系统的屏幕上让我成功的放弃了自己调节车内空调的习惯，因为系统打开时候的卡顿，auto模式成为了我常年的选择。一直很好奇为什么这些大的汽车厂商不能认真优化一下自己的UI，现在手机厂商满地起，为什么不能也顺便入侵一下这些传统行业呢？可能carplay是最终一个很好的解决方案，但是作为汽车厂商，也不应该放任其他厂商控制自己车内重要的驾驶交互环节。 最后吐槽一下各方面的做工，不论是方向盘按钮，还是后备箱或者手套箱，都有着一种浓浓的廉价感，而且这种体验是在摸过了同样日系的q50后逐渐加深的，于是现在每次用方向盘上的控制按钮的时候，都有一种“好好赚钱买好车”的冲动。</p> <p><img src="/assets/img/in-post/15319693174453/15319704296420.jpg" alt=""/></p> <h3 id="操控">操控</h3> <p>说到操控，先要表扬下这次si只给了手动挡的配置，所以买车的时候没有什么犹豫的，直接手动挡走起。</p> <p><img src="/assets/img/in-post/15319693174453/411531971333.pic.jpg" alt="411531971333_.pi"/></p> <p>非常喜欢这款si的换挡杆，乒乓球型金属挡杆手感非常润滑，换挡手感清晰干脆，而且每次换挡结束有种独特的吸入感，真的让人欲罢不能，记得刚买完这辆车的时候，经常会熄火以后再玩上几分钟的换挡杆。。</p> <p><img src="/assets/img/in-post/15319693174453/421531971334.pic.jpg" alt="421531971334_.pi"/></p> <p>比起换挡杆的出色手感，踏板位置就有点尴尬了，因为油门和刹车踏板距离太远，导致跟趾基本没办法做。看视频好像可以后脚跟放在油门踏板后面，然后脚掌斜挎油门刹车踏板从而在后脚跟稳定的情况下做跟趾，这个还需要练习。离合的感觉相对来说就要好很多，非常的轻而且结合点非常好找，在刚开始练习熄火几次之后基本就不再有问题了。</p> <p>动力上来说，因为手动挡的关系，让我对加速有了更多的欲望和控制，所以这也就让这辆si可以在城市或者高速路上路口轻松加到我需要的速度，而且每一次换挡前强烈的吸力配合上换挡后略微把身体向前推的惯性，让人欲罢不能。当然必须要吐槽的一点是这辆车的rev hang比较令人烦恼，尤其是1挡换2挡想要平顺的话必须要等一会松离合，好像这个功能与燃油经济性有关还是什么，通过ktuner好像可以解决这个问题，等我攒够钱可以尝试一下，如果消除了rev hang，那起步速度应该会有很大的提升。</p> <p>其实把这辆si和普通的civic拉开差距的地方对我来说就是前轮的限滑差速器（LSD）了，虽然我还没有激烈测试过LSD和open-differential的区别，但是可以感觉出来配备了LSD的si在让我过发卡弯这种道路时有了更强的信心而且从来没有出现过打滑的问题。</p> <h3 id="其他">其他</h3> <p>空间真的有点小，用这个车搬了两次家，苦不堪言，但是后备箱的空间还算decent，不过总体来说之前的hatchback要实用的多。</p> <p>油耗在这个定位的车来说真的挺良心的，对于我这种经常暴力驾驶并且对于空调和音乐音量有着变态追求的人来说，27+mpg的油耗真的算不错了。</p> <p>电子手刹有点失去了拉手刹独有的快感。</p>]]></content><author><name></name></author><category term="life"/><summary type="html"><![CDATA[半年人车体验：第十代思域Si的外观、内饰与驾驶感受]]></summary></entry><entry><title type="html">Food that I always want to try again!</title><link href="https://siyuangao.com/blog/2018/food/" rel="alternate" type="text/html" title="Food that I always want to try again!"/><published>2018-06-21T00:00:00+00:00</published><updated>2018-06-21T00:00:00+00:00</updated><id>https://siyuangao.com/blog/2018/food</id><content type="html" xml:base="https://siyuangao.com/blog/2018/food/"><![CDATA[<h2 id="-connecticutranking-reflecting-preference">@ Connecticut（ranking reflecting preference）</h2> <ol> <li>Lin’s Kitchen</li> <li>Lao Sze Chuan</li> <li>Formosa Asian fusion</li> <li>lobster hut (lobster rolls)</li> <li>Takumi Japanese cuisine.</li> <li>mocha noodle bar (chicken wings)</li> </ol> <h2 id="-new-york">@ New York</h2> <ol> <li>Pocha32 (love the Korean ramen there)</li> <li>His and her (Chinese dessert)</li> <li></li> </ol> <h2 id="-buckhead-atlanta">@ Buckhead, Atlanta</h2> <ol> <li>Southern City Kitchen Buckhead (fried chicken is awesome)</li> <li>True Food Kitchen (tataki is awesome)</li> <li>Poor Calvin’s (lobster fried rice there is tasteful with Asian enough flavor)</li> <li>Seven lamps (lobster buns is fresh… omg I love lobster)</li> </ol> <h2 id="phoenix-arizona">@Phoenix, Arizona</h2> <ol> <li>Dust Cutter (avocado fries there is good, also the chicken and waffle)</li> </ol> <h2 id="-杭州-hangzhou排名分先后">@ 杭州 Hangzhou（排名分先后）</h2> <ol> <li>你别走（小龙虾）</li> <li>臻货（海鲜）</li> <li>台海岸（椒盐虾）</li> <li>火狐狸（川菜）</li> <li>塔哈尔（新疆菜）</li> <li>菲滋 （芝士条）</li> <li>夏星酒馆（排骨年糕火锅）</li> <li>淮扬菜馆扬州龙虾（麻辣小龙虾）</li> <li>大鸡腿</li> <li>普罗旺斯（法餐）</li> </ol>]]></content><author><name></name></author><category term="life"/><summary type="html"><![CDATA[a foodie's incomplete guide to restaurants worth a second visit]]></summary></entry><entry><title type="html">Lecture notes for Stat665</title><link href="https://siyuangao.com/blog/2016/the-post-3605/" rel="alternate" type="text/html" title="Lecture notes for Stat665"/><published>2016-07-10T00:00:00+00:00</published><updated>2016-07-10T00:00:00+00:00</updated><id>https://siyuangao.com/blog/2016/the-post-3605</id><content type="html" xml:base="https://siyuangao.com/blog/2016/the-post-3605/"><![CDATA[<h3 id="cross-entropy-cost-function">Cross-entropy cost function</h3> <blockquote> <p>Learning slow is due to the shape of the <strong>sigmoid function</strong>.</p> </blockquote> <p>When we use sigmoid function, then the partial derivative of the quadratic cost function for the weight and bias are multiplied by \(\sigma'(z)\). For example, when the desired output is near 0 while the actual output is 1, then the learning is slow although the neuron’s performance is bad.</p> <p>[<img src="/assets/img/in-post/sigmoid.png" alt="sigmoid" title="sigmoid"/>] As we can see, the curve tends to be flat when Z is bigger.</p> <p>Thus, we need a better function than the trivial quadratic cost function. And cross-entropy is one of the alternatives. The cost function is \(C = -\frac{1}{n} \sum_x \left[y \ln a + (1-y ) \ln (1-a) \right],\) With some algebra calculation, we can prove that the partial derivative of the cost function for weights and bias is independent of \(\sigma'(z)\). And it is only related with \(\frac{\partial C}{\partial w_j} = \frac{1}{n} \sum_x x_j(\sigma(z)-y),\)</p> <p>And it is worth noting that</p> <blockquote> <p>the cross-entropy is nearly always the better choice, provided the output neurons are sigmoid neurons.</p> </blockquote> <h3 id="basis-function">Basis function</h3> <p>By inserting knots, we got more piecewise cubic polynomials to fit, which enables us to fit more complex functions.</p> <p>However, without constraint on the border, we may undergo discontinuity on the boundary. To fix this problem, we can (1) force the polynomial to be continuous at the knot by modifying our model (2) we can add indicator functions or truncating function $(x_i-c)_+$ to make a uniform equation.</p> <p>By this will only make the knot point continuous but not no continuous derivative. So we add the continuity condition on the first&amp;second derivative of the function.</p> <p>We can also add additional constraint to two ends of the curve.</p> <p>We should also pay attention to the position of knots and how many knots should we put. Cross-validation can be used to choose the number of knots.</p> <h1 id="week10">Week10</h1> <ul> <li>Nearest neighbor doesn’t suffer from over-fitting as regression that much.</li> <li>Gini index can be used to measure the importance of variable in tree-based classifiers.</li> <li>gbm package for boosting</li> <li>Default variable numbers tried in “randomforest” package tried: <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>if (!is.null(y) &amp;&amp; !is.factor(y))
  max(floor(ncol(x)/3), 1) 
else 
  floor(sqrt(ncol(x)))
</code></pre></div> </div> </li> <li>Bootstrapping generates multiple trees and bagging summarizes them together.</li> <li>Randomforest uses different subsets of variables at each iteration.</li> <li>Boosting tree added variables sequentially.</li> <li>One easily-made mistake for randomForest package is that, when the levels of train and test data are not the same, like if you have a variable with level==[0,1] but it all equals 0 in the test set, then there will be a problem when you predict the test set using the trained model. So you have to preset all the predictor levels in the test set equal to the ones in training set.</li> </ul>]]></content><author><name></name></author><category term="statistics"/><summary type="html"><![CDATA[cross-entropy, softmax, and other highlights from Yale's Stat665]]></summary></entry></feed>