资源简介
KPCA核主成分分析法matlab算法,用于矩阵的特征提取
代码片段和文件信息
% Kernel PCA toy example for k(xy)=exp(-||x-y||^2/rbf_var) cf. Fig. 4 in
% @article{SchSmoMue98
% author = “B.~{Sch\“olkopf} and A.~Smola and K.-R.~{M\“uller}“
% title = “Nonlinear component analysis as a kernel Eigenvalue problem“
% journal = {Neural Computation}
% volume = 10
% issue = 5
% pages = “1299 -- 1319“
% year = 1998}
% This file can be downloaded from http://www.kernel-machines.org.
% Last modified: 4 July 2003
% parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rbf_var = 0.1;
xnum = 4;
ynum = 2;
max_ev = xnum*ynum;
% (extract features from the first Eigenvectors)
x_test_num = 15;
y_test_num = 15;
cluster_pos = [-0.5 -0.2; 0 0.6; 0.5 0];
cluster_size = 30;
% generate a toy data set
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
num_clusters = size(cluster_pos1);
train_num = num_clusters*cluster_size;
patterns = zeros(train_num 2);
range = 1;
randn(‘seed‘ 0);
for i=1:num_clusters
patterns((i-1)*cluster_size+1:i*cluster_size1) = cluster_pos(i1)+0.1*randn(cluster_size1);
patterns((i-1)*cluster_size+1:i*cluster_size2) = cluster_pos(i2)+0.1*randn(cluster_size1);
end
test_num = x_test_num*y_test_num;
x_range = -range:(2*range/(x_test_num - 1)):range;
y_offset = 0.5;
y_range = -range+ y_offset:(2*range/(y_test_num - 1)):range+ y_offset;
[xs ys] = meshgrid(x_range y_range);
test_patterns(: 1) = xs(:);
test_patterns(: 2) = ys(:);
cov_size = train_num; % use all patterns to compute the covariance matrix
% carry out Kernel PCA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1:cov_size
for j=i:cov_size
K(ij) = exp(-norm(patterns(i:)-patterns(j:))^2/rbf_var);
K(ji) = K(ij);
end
end
unit = ones(cov_size cov_size)/cov_size;
% centering in feature space!
K_n = K - unit*K - K*unit + unit*K*unit;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[evecsevals] = eig(K_n);
evals = real(diag(evals));
for i=1:cov_size
evecs(:i) = evecs(:i)/(sqrt(evals(i)));
end
% extract features
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% do not need the following here - only need test point features
%unit_train = ones(train_numcov_size)/cov_size;
%for i=1:train_num
% for j=1:cov_size
% K_train(ij) = exp(-norm(patterns(i:)-patterns(j:))^2/rbf_var);
% end
%end
%K_train_n = K_train - unit_train*K - K_train*unit + unit_train*K*unit;
%features = zeros(train_num max_ev);
%features = K_train_n * evecs(:1:max_ev);
unit_test = ones(test_numcov_size)/cov_size;
K_test = zeros(test_numcov_size);
for i=1:test_num
for j=1:cov_size
K_test(ij) = exp(-norm(test_patterns(i:)-patterns(j:))^2/rbf_var);
end
end
K_test_n = K_test - unit_test*K - K_test*unit + unit_test*K*unit;
test_features = zeros(test_num max_ev);
test_features = K_test_n * evecs(:1:max_ev);
% plot it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3474 2006-06-29 08:10 KPCA主要在图像去噪声方面有应用。此外还可以进行特征提取,降维使用\KPCA\kpca_toy.m
目录 0 2011-09-15 23:24 KPCA主要在图像去噪声方面有应用。此外还可以进行特征提取,降维使用\KPCA
目录 0 2011-09-15 23:24 KPCA主要在图像去噪声方面有应用。此外还可以进行特征提取,降维使用
----------- --------- ---------- ----- ----
3474 3
- 上一篇:二值图像的信息隐藏实验
- 下一篇:MATLAB人脸识别.zip
相关资源
- MATLAB人脸识别.zip
- 二值图像的信息隐藏实验
- 基于船舶运动控制的Matlab仿真
- 声音信号故障诊断
-
基于simuli
nk的曲柄滑块运动机构仿真 - 基于matlab的直序扩频通信系统仿真模
- 基于MATLAB的多服务台排队系统分析
- 智能预测控制及其MATLAB实现(第2版)
- 遗传算法优化小波神经网络程序matl
- matlab数值分析程序(超详细)
- 随机森林工具箱
- welch法谱估计matlab实现
- 控制系统稳定性分析的matlab实现实验
- 关于小波分析的matlab程序
- 数字图像处理的MATLAB小程序
- matlab车牌定位程序
- matlab心率分析
- 灰色神经网络预测模型 matlab程序
- matlab六杆机构分析原创
- 空间杜宾模型SDM的Matlab工具箱
- MATLAB数学建模工具箱
- 《精通MATLAB神经网络》代码
- 16QAM信号调制解调Matlab仿真
- 基于matlab实现模态分析的代码
- matlab脑电信号处理
- 基于matlab的八个方向sobel图像边缘检测
- 升、降压直流斩波电路及matlab仿真
- 二阶RLC串联电路的零输入响应matlab课
- 加权灰关联模型matlab程序
- DSP2812基于MATLAB模块化编程的SPWM调制实
评论
共有 条评论