pca 主成分分析_通过主成分分析(PCA)了解您的数据并发现潜在模式

article/2025/9/21 18:29:53

pca 主成分分析

Save time, resources and stay healthy with data exploration that goes beyond means, distributions and correlations: Leverage PCA to see through the surface of variables. It saves time and resources, because it uncovers data issues before an hour-long model training and is good for a programmer’s health, since she trades off data worries with something more enjoyable. For example, a well-proven machine learning model might fail, because of one-dimensional data with insufficient variance or other related issues. PCA offers valuable insights that make you confident about data properties and its hidden dimensions.

超越均值,分布和相关性的数据探索可节省时间,资源并保持健康:利用PCA透视变量的表面。 它节省了时间和资源,因为它一小时的模型训练之前就发现了数据问题并且对程序员的健康非常有益,因为她可以用更有趣的东西来权衡数据的烦恼。 例如,由于一维数据的方差不足或其他相关问题,一个经过充分验证的机器学习模型可能会失败。 PCA提供了宝贵的见解,使您对数据属性及其隐藏维度充满信心。

This article shows how to leverage PCA to understand key properties of a dataset, saving time and resources down the road which ultimately leads to a happier, more fulfilled coding life. I hope this post helps to apply PCA in a consistent way and understand its results.

本文展示了如何利用PCA来理解数据集的关键属性,从而节省时间和资源,最终使编码寿命更长寿,更令人满意。 我希望这篇文章有助于以一致的方式应用PCA并了解其结果。

TL; DR (TL;DR)

PCA provides valuable insights that reach beyond descriptive statistics and help to discover underlying patterns. Two PCA metrics indicate 1. how many components capture the largest share of variance (explained variance), and 2., which features correlate with the most important components (factor loading). These metrics crosscheck previous steps in the project work flow, such as data collection which then can be adjusted. As a shortcut and ready-to-use tool, I provide the function do_pca() which conducts a PCA for a prepared dataset to inspect its results within seconds in this notebook or this script.

PCA提供了有价值的见解,这些见解超出了描述性统计数据的范围,并有助于发现潜在的模式。 两个PCA指标指示1.捕获最大方差份额的成分( 解释了方差 ),以及2.与最重要的成分相关的特征( 要素负载 )。 这些度量标准可以交叉检查项目工作流程中的先前步骤 ,例如可以进行数据收集的调整 作为一种快捷且易于使用的工具,我提供了do_pca()函数,该函数为准备好的数据集执行PCA,以在此笔记本或此脚本中在几秒钟内检查其结果。

数据探索作为安全网 (Data exploration as a safety net)

When a project structure resembles the one below, the prepared dataset is under scrutiny in the 4. step by looking at descriptive statistics. Among the most common ones are means, distributions and correlations taken across all observations or subgroups.

当项目结构类似于以下结构时,通过查看描述性统计数据,将在第4步中仔细检查准备的数据集。 最常见的是在所有观察值或子组中采用的均值,分布和相关性。

Common project structure

共同的项目结构

  1. Collection: gather, retrieve or load data

    收集:收集,检索或加载数据
  2. Processing: Format raw data, handle missing entries

    处理:格式化原始数据,处理缺失的条目
  3. Engineering: Construct and select features

    工程:构造和选择特征
  4. Exploration: Inspect descriptives, properties

    探索:检查描述,属性

  5. Modelling: Train, validate and test models

    建模:训练,验证和测试模型
  6. Evaluation: Inspect results, compare models

    评估:检查结果,比较模型

When the moment arrives of having a clean dataset after hours of work, makes many glances already towards the exciting step of applying models to the data. At this stage, around 80–90% of the project’s workload is done, if the data did not fell out of the sky, cleaned and processed. Of course, the urge is strong for modeling, but here are two reasons why a thorough data exploration saves time down the road:

在经过数小时的工作后,有了一个干净的数据集的时刻到来时,已经将许多目光投向了将模型应用于数据的令人兴奋的步骤。 在这个阶段,如果数据没有从天而降,清理和处理,则大约完成了项目工作量的80–90%。 当然,建模的冲动很强烈,但是这里有 彻底的数据探索可以节省时间的两个原因:

  1. catch coding errors → revise feature engineering (step 3)

    捕获编码错误 →修改特征工程(步骤3)

  2. identify underlying properties → rethink data collection (step 1), preprocessing (step 2) or feature engineering (step 3)

    识别基础属性 →重新考虑数据收集(步骤1),预处理(步骤2)或特征工程(步骤3)

Wondering about underperforming models due to underlying data issues after a few hours into training, validating and testing is like a photographer on the set, not knowing how their models might look like. Therefore, the key message is to see data exploration as an opportunity to get to know your data, understanding its strength and weaknesses.

经过数小时的培训,验证和测试后,由于底层数据问题而导致模型表现不佳的问题,就像布景中的摄影师一样,不知道其模型会是什么样子。 因此,关键信息是将数据探索视为了解您的数据 ,了解其优势和劣势的机会。

Descriptive statistics often reveal coding errors. However, detecting underlying issues likely requires more than that. Decomposition methods such as PCA help to identify these and enable to revise previous steps. This ensures a smooth transition to model building.

描述性统计通常会揭示编码错误。 但是,要发现潜在的问题可能还需要更多。 分解方法(例如PCA)有助于识别这些方法,并可以修改以前的步骤。 这样可以确保顺利过渡到模型构建。

Image for post
Photo by Harrison Haines from Pexels
Pexels的 Harrison Haines 摄

用PCA看表面之下 (Look beneath the surface with PCA)

Large datasets often require PCA to reduce dimensionality anyway. The method as such captures the maximum possible variance across features and projects observations onto mutually uncorrelated vectors, called components. Still, PCA serves other purposes than dimensionality reduction. It also helps to discover underlying patterns across features.

无论如何,大型数据集通常需要PCA来减少维数。 这样的方法捕获了整个特征的最大可能方差,并将观测值投影到互不相关的向量(称为分量)上。 尽管如此,PCA还可以实现降维以外的其他目的。 它还有助于发现跨功能的基础模式。

To focus on the implementation in Python instead of methodology, I will skip describing PCA in its workings. There exist many great resources about it that I refer to those instead:

为了专注于Python的实现而不是方法论,我将不介绍PCA的工作原理。 我有很多关于它的大量资源可供参考:

  • Animations showing PCA in ac


http://chatgpt.dhexx.cn/article/suG7ajsJ.shtml

相关文章

R中的主成分和因子分析

2019独角兽企业重金招聘Python工程师标准>>> 主成分分析(PCA) a、一种降维技巧,将大量相关变量转化为一组很少的相关变量,这些 无关变量称为主成分 b、用一组较少的不相关变量代替大量相关变量,同时尽可能保留初始变量的信息&…

时间序列预测法

转 时间序列预测法 一种历史资料延伸预测,也称历史引伸预测法。是以时间数列所能反映的社会经济现象的发展过程和规律性,进行引伸外推,预测其发展趋势的方法。 时间序列,也叫时间数列、历史复数或动态数列。它是将某种统计指标的…

甲基化系列 3. 甲基化芯片数据分析完整版(ChAMP)

点击关注,桓峰基因 桓峰基因 生物信息分析,SCI文章撰写及生物信息基础知识学习:R语言学习,perl基础编程,linux系统命令,Python遇见更好的你 104篇原创内容 公众号 桓峰基因的教程不但教您怎么使用&…

R 语言之数据分析高级方法「主成分分析」和「因子分析」

‍‍‍‍‍‍‍‍‍ 作者:姚某某 博客:https://zhuanlan.zhihu.com/mydata 往期回顾: R语言之数据分析高级方法「时间序列」 R语言之高级数据分析「聚类分析」 本节主要总结「数据分析」的「主成分分析」和「因子分析」的思想。 通过学习《 R…

转:Android 中Makefile的详细分析

http://blog.chinaunix.net/uid-25838286-id-3204120.html 随着移动互联网的发展,移动开发也越来越吃香了,目前最火的莫过于android,android是什么就不用说了,android自从开源以来,就受到很多人的追捧。当然&#xff0…

Python数据分析理论与实战完整版本

Python数据分析基础 一、Python数据分析初探二、数据获取2.1 数据获取的手段2.2 数据仓库2.3 检测与抓取2.4 填写、埋点、日志2.5 计算2.6 数据学习网站 三、单因子探索分析与可视化3.1 理论铺垫3.2 数据分类3.3 单属性分析3.4 单因子分析实战3.5 可视化小节 四、多因子探索分析…

223.主成分分析PCA

主成分分析 PCA 本节作者:刘华,中国科学技术大学 版本1.0.3,更新日期:2020年6月18日 什么是PCA(Principal Component Analysis) 相关背景 在许多领域的研究与应用中,通常需要对含有多个变量的数据进行观测,…

探索性数据分析EDA(二)—— 缺失值处理

接上一篇 《探索性数据分析(1)—— 变量识别和分析》, 这篇笔记主要内容为缺失值处理方法介绍,以及相关python工具包sklearn.impute的使用介绍。 目录 1. 为什么需要处理缺失值2. 为什么数据有缺失值a) 完全随机缺失(…

数据分析汇总

一、本文说明: 本文为自己学习的笔记,用来记录数分的相关知识,方便记录查阅。 二、指标体系建设与数据分析: 1、指标体系概念: ①:什么是指标体系: 企业指标的集合 ②:好…

5whys分析法在美团工程师中的实践

2019独角兽企业重金招聘Python工程师标准>>> 前言 网站的质量和稳定性对于用户和公司来说至关重要,但是在网站的快速发展过程中,由于各种原因导致事故不可避免的发生,这些大大小小的事故对公司难免会造成一些负面的影响&#xff0…

单因素方差分析的计算过程详解

统计分析之单因素方差分析计算过程详解 Excel方差分析 用Excel计算方差分析,三种方法: 一步步手推法 用Excel的数据分析→单因素方差分析自动生成 在1的基础上通过SUMX2MY2优化法 Excel版操作步骤可参见 Excel单因素方差分析操作详解 P…

哈佛大学——差异表达分析(九)DESeq2步骤描述

文章目录 学习目标DESeq2差异基因表达分析流程第一步:估计大小因子第二步:估计基因离散(gene-wise dispersion)第三步:拟合曲线到基因的分散估计第四步:将基因离散估计值向曲线预测值收缩MOV10 DE分析:探讨离散估计和评…

数学建模之层次分析法(AHP)

层次分析法(Analytic Hierarchy Process) AHP是对一些较为复杂的,较为模糊的问题作出决策的简易方法,它特别适用于那些难以完全定量分析的问题。由美国运筹学家T.L.Saaty教授于上世纪70年代初期提出。 目录 层次分析法&#xff0…

时序分析-季节因素

目录 1时序分析的基础 1.1 简介 1.2 分类 2 分析套路 3 主流时序分析模型 3.1移动平均 3.2 指数平滑法 3.3 组合模型 3.4 ARIMA 4 研究细分领域 4.1 异常值检测 4.2 季节序列分析 4.1 同期平均法 4.1.1 简单季节指数法 4.1.2 趋势季节指数法 4.2 长期趋势剔除法…

html5播放器的示例代码

本次的分享是一个基于HTML5标签实现的一个自定义视频播放器。其中实现了播放暂停、进度拖拽、音量控制及全屏等功能。 效果预览 核心思路 我相信一定会有些没有接触过制作自定义播放器的童鞋对于 标签的认识会停留在此。 <video controls"controls" autoplay"…

HTML5音乐播放器

明月浩空-HTML5浮窗音乐播放器研发于2014年&#xff0c;并持续更新至今 是基于QQ音乐、酷狗音乐、网易云音乐等歌曲ID全自动解析的网页音乐播放器 依靠服务器强大的接口功能&#xff0c;只需要一个ID既可获取全部信息 同时播放器主体会跟随专辑图片主色值自动变色&#xff0c;歌…

h5的开源播放器组件

哈喽&#xff0c;大家好&#xff0c;今天我要给大家推荐一个非常棒的看片神器&#xff0c;那就是【moovie】.它是一款专注于电影的HTML5 播放器。 先展示一下效果&#xff0c;测试了一下&#xff0c;支持倍速播放、快捷键操作、字幕偏移即时调整&#xff0c;还有一些参数展示&a…

H5播放器使用方法。

1.使用webkit-playsinline playsinline 在iOS微信webview中视频不会弹出来&#xff0c;直接播放。 <video id"test_video" class"test_video" webkit-playsinline playsinlinesrc"http://res.imtt.qq.com/qqbrowser/js/advideo.mp4"control…

H5,Audio音乐播放器(移动版)

有些时候&#xff0c;总是感觉自己进步的没有以前快了。于是就怀疑自己是不是也被时间磨灭了&#xff0c;这可真是一件不幸的事儿。可能是自己会的东西太少了&#xff0c;总是有种莫名的危机感。 前一段时间&#xff0c;想写一个移动版音乐播放器&#xff0c;于是就开始利用下班…

H5 video 播放器demo

H5 video 播放器demo 前言 最近在做一个wap端的项目&#xff0c;需要视频播放功能。大家也知道wap对flash支持很差&#xff0c;所以优先考虑使用h5播放器video,在这里我介绍用video实现视频播放方法。之后在介绍几个插件和第三方视频实现方法。 H5 video 因为video样式是原…