我目前正尝试在R中进行PCA,这是我在数据挖掘方面的第一个项目。我有大约200个特性和大约3000行数据。
数据不是在规范化的形式,我需要进行降维,所以我使用PCA作为同样的。这就是我到现在为止所做的
x <- princomp(data,scores=TRUE,cor=TRUE)我应该进行降维,我应该看分数值。所以我确实得到了最重要的价值
head(x$scores)这是输出
Comp.1 Comp.2 Comp.3 Comp.4 ...
[1,] 6.831452 -4.4316218 -1.9226226 -0.8344245
[2,] -1.808007 -4.2743390 1.0173944 0.4527465
[3,] -7.750329 -4.9523056 -1.6750438 1.6247354
.
.
.现在,我不知道如何解释这些矩阵并获得最佳属性(并进行维数约简)。如果有人能帮我解决这个问题,那就太好了。
我搜了很多遍,但没有得到同样的答案。
发布于 2013-10-13 11:05:10
scores只是拼图中的一部分。一般的公式是:
original_data =~ approximation = (scores * loadings) * scale + center其中:
1. `scores` are the coordinates in your new orthogonal base
1. `loadings` are the directions of the new axis in the old base
1. `scale` are the scaling applied to the dimensions
1. `center` are the coordinates of the new base origin in the old base使用R对象,上面的公式是
data =~ t(t(x$scores %*% t(x$loadings)) * x$scale + x$center)您希望只使用第一个i加载来减少维度:
data =~ t(t(x$scores[, 1:i] %*% t(x$loadings[, 1:i ])) * x$scale + x$center)https://stackoverflow.com/questions/19344016
复制相似问题