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

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

问题描述

我有一个 (26424 x 144) 数组,我想使用 Python 对其执行 PCA.但是,网络上没有特定的地方解释如何完成此任务(有些网站只是根据自己的情况进行 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)

results 将存储 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天全站免登陆