【问题标题】:interpreting princomp results解释princomp结果
【发布时间】:2013-10-13 10:12:22
【问题描述】:

我目前正在尝试在 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 
.
.
.

现在我不确定如何解释这些矩阵并获得最佳属性(并进行降维)。如果有人能帮我解决这个问题,那就太好了。

P.S - 我搜索了很多,但没有得到相同的答案。

【问题讨论】:

    标签: r pca


    【解决方案1】:

    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)
    

    【讨论】:

    • 我认为他们应该先看看summary。当然,他们可能实际上应该进行因子分析而不是 PCA。
    • @Roland - 感谢您的意见。我确实看了总结。您能否详细说明为什么我应该使用因子分析而不是 PCA?
    • 我不知道您是否应该这样做,因为您的任务没有明确定义。做一些阅读。
    • @Roland - 我正在尝试使用数据构建预测分类模型。感谢您的输入。肯定会阅读更多材料
    猜你喜欢
    • 2017-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-09
    • 2017-06-13
    • 2020-07-28
    相关资源
    最近更新 更多