How to get the 1st Principal Component by PCA using Python?

前端 未结 3 1983
星月不相逢
星月不相逢 2020-12-21 22:55

I have a set of 2D vectors presented in a n*2 matrix form.

I wish to get the 1st principal component, i.e. the vector that indicates the direction with

3条回答
  •  轮回少年
    2020-12-21 23:34

    PCA gives only 2d vecs from 2d data.

    Look at the picture in Wikipedia PCA:
    starting with a point cloud (dataMatrix) like that, and using matplotlib.mlab.PCA,
    myPCA.Wt[0] is the first PC, the long one in the picture.

提交回复
热议问题