【问题标题】:Principal Component Analysis - why eigenvectors' dot product aren't zeros?主成分分析 - 为什么特征向量的点积不是零?
【发布时间】:2018-02-25 14:06:36
【问题描述】:

我尝试使用 Python sklearn 对 Breast_canser 数据集进行主成分分析。 并且无法理解为什么特征向量的两个点积(3 个分量)都不是零?

frst = pca.components_[0,:]
scnd = pca.components_[1,:]
thrd = pca.components_[2,:]
orth1 = np.dot(frst,scnd)
orth2 = np.dot(scnd, thrd)
print(orth1.real)
print(orth2.real)

出来:

0.0

1.52655665886e-16

【问题讨论】:

标签: python scikit-learn pca eigenvector orthogonal


【解决方案1】:

浮点运算并不总是 100% 准确,因为计算机使用有限数量的数字来表示具有无限位数的数字。 1.52655665886e-16 ~ machine epsilon 浮点运算导致的相对误差的上限,所以我把它算作0。

编辑: 如果您的矩阵没有不同的特征值,您也可能会遇到此问题。

【讨论】:

    猜你喜欢
    • 2013-10-21
    • 1970-01-01
    • 2020-07-27
    • 2018-04-11
    • 2016-01-16
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 2020-11-08
    相关资源
    最近更新 更多