核主元分析KPCA的降维特征提取以及故障检测应用-Kernel Principal Component Analysis .zip
本帖最后由 iqiukp 于 2018-11-9 15:02 编辑
核主元分析(Kernel principal component analysis ,KPCA)在降维、特征提取以及故障检测中的应用。主要功能有:(1)训练数据和测试数据的非线性主元提取(降维、特征提取)
(2)SPE和T2统计量及其控制限的计算
(3)故障检测
参考文献:
Lee J M, Yoo C K, Choi S W, et al. Nonlinear process monitoring using kernel principal component analysis[J]. Chemical engineering science, 2004, 59: 223-234.
1. KPCA的建模过程(故障检测):
(1)获取训练数据(工业过程数据需要进行标准化处理)
(2)计算核矩阵
(3)核矩阵中心化
(4)特征值分解
(5)特征向量的标准化处理
(6)主元个数的选取
(7)计算非线性主成分(即降维结果或者特征提取结果)
(8)SPE和T2统计量的控制限计算
function model = kpca_train
% DESCRIPTION
% Kernel principal component analysis
%
% mappedX = kpca_train
%
% INPUT
% X Training samples
% N: number of samples
% d: number of features
% options Parameters setting
%
% OUTPUT
% model KPCA model
%
%
% Created on 9th November, 2018, by Kepeng Qiu.
% number of training samples
L = size;
% Compute the kernel matrix
K = computeKM;
% Centralize the kernel matrix
unit = ones/L;
K_c = K-unit*K-K*unit unit*K*unit;
% Solve the eigenvalue problem
[V,D] = eigs;
lambda = diag;
% Normalize the eigenvalue
V_s = V ./ sqrt';
% Compute the numbers of principal component
% Extract the nonlinear component
if options.type == 1 % fault detection
dims = find) >= 0.85,1, 'first');
else
dims = options.dims;
end
mappedX = K_c* V_s ;
% Store the results
model.mappedX = mappedX ;
model.V_s = V_s;
model.lambda = lambda;
model.K_c = K_c;
model.L = L;
model.dims = dims;
model.X = X;
model.K = K;
model.unit = unit;
model.sigma = options.sigma;
% Compute the threshold
model.beta = options.beta;% corresponding probabilities
[SPE_limit,T2_limit] = comtupeLimit;
model.SPE_limit = SPE_limit;
model.T2_limit = T2_limit;
end复制代码2. KPCA的测试过程:
(1)获取测试数据(工业过程数据需要利用训练数据的均值和标准差进行标准化处理)
(2)计算核矩阵
(3)核矩阵中心化
(4)计算非线性主成分(即降维结果或者特征提取结果)
(5)SPE和T2统计量的计算
function [SPE,T2,mappedY] = kpca_test
% DESCRIPTION
% Compute th
2021-05-03 15:34:52
20KB
matlab
1