Python中的主成分分析(PCA) [英] Principal Component Analysis (PCA) in Python

查看:186
本文介绍了Python中的主成分分析(PCA)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(26424 x 144)数组,我想使用Python在其上执行PCA.但是,Web上没有特定位置说明如何实现此任务(有些站点只是根据自己的站点进行PCA,因此无法找到通用的方法).任何有任何帮助的人都会做得很好.

I have a (26424 x 144) array and I want to perform PCA over it using Python. However, there is no particular place on the web that explains about how to achieve this task (There are some sites which just do PCA according to their own - there is no generalized way of doing so that I can find). Anybody with any sort of help will do great.

推荐答案

您可以在matplotlib模块中找到PCA函数:

You can find a PCA function in the matplotlib module:

import numpy as np
from matplotlib.mlab import PCA

data = np.array(np.random.randint(10,size=(10,3)))
results = PCA(data)

结果将存储PCA的各种参数. 它来自matplotlib的mlab部分,这是与MATLAB语法兼容的层

results will store the various parameters of the PCA. It is from the mlab part of matplotlib, which is the compatibility layer with the MATLAB syntax

在博客 nextgenetics 上,我找到了关于如何使用matplotlib执行和显示PCA的精彩演示. mlab模块,玩得开心并检查该博客!

on the blog nextgenetics I found a wonderful demonstration of how to perform and display a PCA with the matplotlib mlab module, have fun and check that blog!

这篇关于Python中的主成分分析(PCA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆