资源简介
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
相关资源
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
- k近邻算法matlab实现
- matlab识别系统
评论
共有 条评论