PCA数据预处理MATLAB

Reduce Input Dimensionality Using processpca
In some situations, the dimension of the input vector is large, but the components of the vectors are highly correlated (redundant). It is useful in this situation to reduce the dimension of the input vectors. An effective procedure for performing this operation is principal component analysis. This technique has three effects: it orthogonalizes the components of the input vectors (so that they are uncorrelated with each other), it orders the resulting orthogonal components (principal components) so that those with the largest variation come first, and it eliminates those components that contribute the least to the variation in the data set. The following code illustrates the use of processpca, which performs a principal-component analysis using the processing setting maxfrac of 0.02.

[pn,ps1] = mapstd(p);
[ptrans,ps2] = processpca(pn,0.02);

The input vectors are first normalized, using mapstd, so that they have zero mean and unity variance. This is a standard procedure when using principal components. In this example, the second argument passed to processpca is 0.02. This means that processpca eliminates those principal components that contribute less than 2% to the total variation in the data set. The matrix ptrans contains the transformed input vectors. The settings structure ps2 contains the principal component transformation matrix. After the network has been trained, these settings should be used to transform any future inputs that are applied to the network. It effectively becomes a part of the network, just like the network weights and biases. If you multiply the normalized input vectors pn by the transformation matrix transMat, you obtain the transformed input vectors ptrans.

If processpca is used to preprocess the training set data, then whenever the trained network is used with new inputs, you should preprocess them with the transformation matrix that was computed for the training set, using ps2. The following code applies a new set of inputs to a network already trained.

pnewn = mapstd('apply',pnew,ps1);
pnewtrans = processpca('apply',pnewn,ps2);
a = sim(net,pnewtrans);

Principal component analysis is not reliably reversible. Therefore it is only recommended for input processing. Outputs require reversible processing functions.
在这里插入图片描述
在这里插入图片描述

相关推荐

  1. 数据预处理 matlab & 数据质量评估

    2024-06-10 14:30:06       62 阅读
  2. python pandas 数据预处理

    2024-06-10 14:30:06       56 阅读
  3. 数据预处理

    2024-06-10 14:30:06       33 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-10 14:30:06       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-10 14:30:06       100 阅读
  3. 在Django里面运行非项目文件

    2024-06-10 14:30:06       82 阅读
  4. Python语言-面向对象

    2024-06-10 14:30:06       91 阅读

热门阅读

  1. web前端报名点:深入探索与报名流程指南

    2024-06-10 14:30:06       23 阅读
  2. 深拷贝&浅拷贝解析,从原理理解深拷贝

    2024-06-10 14:30:06       34 阅读
  3. 不要使用业务键作为数据库主键

    2024-06-10 14:30:06       34 阅读
  4. C# WPF入门学习主线篇(十八)—— Border布局容器

    2024-06-10 14:30:06       14 阅读
  5. 爬山算法的详细介绍

    2024-06-10 14:30:06       27 阅读
  6. SSRF 漏洞实践:端口扫描与任意文件读取

    2024-06-10 14:30:06       31 阅读
  7. SpringBoot实现上传头像(查看头像)

    2024-06-10 14:30:06       30 阅读
  8. 模拟CAS算法案例

    2024-06-10 14:30:06       24 阅读
  9. DeepSpeed Autotuning

    2024-06-10 14:30:06       29 阅读
  10. 10-Eureka-服务注册

    2024-06-10 14:30:06       23 阅读
  11. 在docker容器中使用gdb调试python3.11的进程

    2024-06-10 14:30:06       28 阅读