当前位置:网站首页>PCA主成分分析(降维)过程推导
PCA主成分分析(降维)过程推导
2022-07-17 00:10:00 【elkluh】
主成分分析的作用是降维。当数据量有多个维度时,有些维度对于数据的贡献大,有些维度对数据的贡献小。通过主成分分析,找到重要的维度,能大大减少计算量。
PCA的中心思想:
一个中心:原始特征空间的重构。
两个基本点:最大投影方差,最小重构距离。
---------------------------------------------------------------------------------------------------------------------------------
最小重构距离通过下面的式子来构建。
重构前:(xn是去中心化的每个样本)

表示原始的点,能表示成d个向量(d个维度)的和。通过分解,它能够分解到两组向量上,PCA保留了一部分,舍弃了一部分,舍弃了
这部分,保留了
这部分。a是每个分解的向量u上的长度,相乘后求和就可以重构原样本。
一个点投影到u_m上的效果,和所有点投影到紫色的线上的效果(二维转化为一维)


重构后:

重构的代价就是使重构前后的距离最小:(两个式子相减后剩下后面这部分)

这里的S是协方差矩阵。
则损失函数为:

使用拉格朗日乘子约束优化,式子变成:
(1)拉格朗日优化后

(2)求导

则:
(3)结果:

表示S的特征向量,
表示特征值 。
---------------------------------------------------------------------------------------------------------------------------------
则PCA的步骤为:
1.求平均值,去中心化


2.计算协方差矩阵
![\mathbf{S}=\frac{1}{N} \sum_{n=1}^{N} \mathbf{x}_{n}^{\text {norm }}\left[\mathbf{x}_{n}^{\text {norm }}\right]^{T}](http://img.inotgo.com/imagesLocal/202207/19/202207170006024996_7.gif)
3.特征分解

矩阵分解的过程就像下面这样子
![\mathbf{S}=\left[\begin{array}{ccc}\sigma_{11}^{2} & \ldots & \sigma_{1 M}^{2} \\ \vdots & \ddots & \vdots \\ \sigma_{M 1}^{2} & \cdots & \sigma_{M M}^{2}\end{array}\right]=\mathbf{U} \boldsymbol{\Lambda} \mathbf{U}^{T}=\left[\begin{array}{lll}\mathbf{U}_{s} & \mid & \mathbf{U}_{\mathbf{n}}\end{array}\right]\left[\begin{array}{c|c}\boldsymbol{\Lambda}_{s} & \mathbf{0} \\ \hline \mathbf{0} & \boldsymbol{\Lambda}_{n}\end{array}\right]\left[\begin{array}{c}\mathbf{U}_{s}^{T} \\ \hline \mathbf{U}_{\mathbf{n}}{ }^{T}\end{array}\right]](http://img.inotgo.com/imagesLocal/202207/19/202207170006024996_14.gif)
4.用特征值
对U的列进行排序
5.选择M个特征向量,形成
6.进行投影


边栏推荐
- The platform of digital collection NFT is good
- Cannot find module ‘process‘ or its corresponding type declarations.
- 蛟分承影,雁落忘归——袋鼠云一站式全自动化运维管家ChengYing(承影)正式开源
- 常见的Go写文件方式
- 6章 性能平台GodEye源码分析-自定义拓展模块
- Fair Multiple Decision Making Through Soft Interventions
- nodejs-uuid
- wkwebview白屏
- 组合键截图分析
- C language operator priority
猜你喜欢
Mxnet network model (IV) Gan neural network

Dhfs read / write process
[go language] code coverage test (Gcov)

touchID 和 FaceID~1

4章 性能平台GodEye源码分析-监控模块

Leveraging Semi-Supervised Learning for Fairness using Neural Networks

Why is opensea the absolute monopolist of NFT trading market?

apt-get update报错:Hash 校验和不符
![[MySQL] windows install MySQL 5.7](/img/71/be5b0cc3e130c2b9f3884d90b9cd39.jpg)
[MySQL] windows install MySQL 5.7

Scala environment construction
随机推荐
Xcode11添加引导页(升级后Launch Images Source选项不见了)
Dhfs read / write process
touchID 和 FaceID~2
一种5G空口单向时延及其可靠性的测量方法
Boost线程池
Apt get update error: hash checksum does not match
Why do you spend 1.16 million to buy an NFT avatar in the library of NFT digital collections? The answer may be found by reviewing the "rise history" of NFT avatars
The following packages have unmet dependencies: deepin.com.wechat:i386 : Depends: deepin-wine:i386
Neutralizing Self-Selection Bias in Sampling for Sortition
实时开发平台建设实践,深入释放实时数据价值丨04期直播回顾
[go language] code coverage test (Gcov)
Handling Conditional Discrimination(可解释歧视和确切的歧视)
[literature reading] multi state MRAM cells for hardware neural computing
[literature reading] mcunet: tiny deep learning on IOT devices
5章 性能平台GodEye源码分析-第三方模块
Detailed explanation of errno
未成年人数字安全保护的问题与对策
Cannot find module ‘process‘ or its corresponding type declarations.
【pycharm】Cannot find reference ‘XXX‘ in ‘__ init__. Py 'solution
MapReduce environment preparation