<p>经过一番挖掘,我澄清了一些,但不是全部,我在这方面的困惑。此问题已在stats.stackexchange<a href="https://stats.stackexchange.com/questions/88880/does-the-sign-of-scores-or-of-loadings-in-pca-or-fa-have-a-meaning-may-i-revers">here</a>中讨论过。数学上的答案是“PCA是一个简单的数学变换。如果更改组件的符号,则不会更改第一个组件中包含的方差。“<em>但是</em>,在这种情况下(使用<code>sklearn.PCA</code>),歧义的来源更为具体:在<code>PCA</code>的源(<a href="https://github.com/scikit-learn/scikit-learn/blob/4c65d8e/sklearn/decomposition/pca.py#L391" rel="nofollow noreferrer">line 391</a>)中,您有:</p>
<pre><code>U, S, V = linalg.svd(X, full_matrices=False)
# flip eigenvectors' sign to enforce deterministic output
U, V = svd_flip(U, V)
components_ = V
</code></pre>
<p><code>svd_flip</code>依次定义为<a href="https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/extmath.py#L500" rel="nofollow noreferrer">here</a>。但是,为什么这些标志会被翻转成“确保输出<a href="https://en.wikipedia.org/wiki/Deterministic_algorithm" rel="nofollow noreferrer">deterministic</a>”,我不确定。(<em>此时已找到U,S,V</em>)。因此,虽然<code>sklearn</code>的实现并不错误,但我认为这并不是那么直观。任何熟悉贝塔系数(beta)概念的金融界人士都会知道,第一主成分很可能与广义市场指数类似。问题是,<code>sklearn</code>实现会给第一个主组件带来很强的负加载。</p>
<p>我的解决方案是一个简化的<a href="https://github.com/bsolomon1/pca/blob/master/pca.py" rel="nofollow noreferrer">version</a>,它不实现<code>svd_flip</code>。它没有<code>sklearn</code>参数,比如<code>svd_solver</code>,但是有很多专门针对这个目的的方法,这是非常简单的。</p>