Python 主成分分析-为什么特征向量';dot产品是';t零?
我尝试使用Python sklearn对乳腺癌数据集进行主成分分析。 不明白为什么特征向量的两个点积(3个分量)都不是零Python 主成分分析-为什么特征向量';dot产品是';t零?,python,scikit-learn,pca,eigenvector,orthogonal,Python,Scikit Learn,Pca,Eigenvector,Orthogonal,我尝试使用Python sklearn对乳腺癌数据集进行主成分分析。 不明白为什么特征向量的两个点积(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.52655
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浮点运算并非总是100%准确,因为计算机使用有限数量的数字来表示具有无限数字的数字
1.52655665886e-16
~浮点运算导致的相对误差上限,因此我将其计为0
编辑:
如果你的矩阵没有不同的特征值,你也可能会遇到这个问题。浮点运算并不总是100%准确,因为计算机使用有限数量的数字来表示无限数量的数字
1.52655665886e-16
~浮点运算导致的相对误差上限,因此我将其计为0
编辑:
如果你的矩阵没有不同的特征值,你也可能会遇到这个问题。可能的重复