📄 kpca_test.m
字号:
% kpca_test.m is a script that tests
%
% kpca_calc.m
% kpca_map.m
% kpca_plot.m
%
% using the same data as kpca_toy.m by Bernhard Schoelkopf. The
% code generating the data is stolen from there.
%
% sth * 12MAR2002
% begin: code from kpca_toy.m
% parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
rbf_var = 0.1;
xnum = 4;
ynum = 2;
max_ev = xnum*ynum;
% (extract features from the first <max_ev> Eigenvectors)
cluster_pos = [-0.5 -0.2; 0 0.6; 0.5 0];
cluster_size = 30;
% generate a toy data set
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
num_clusters = size(cluster_pos,1);
train_num = num_clusters*cluster_size;
patterns = zeros(train_num, 2);
randn('seed', 0);
for i=1:num_clusters,
patterns((i-1)*cluster_size+1:i*cluster_size,1) = cluster_pos(i,1)+0.1*randn(cluster_size,1);
patterns((i-1)*cluster_size+1:i*cluster_size,2) = cluster_pos(i,2)+0.1*randn(cluster_size,1);
end
% end: code from kpca_toy.m
x = patterns';
kernel = {'gaussian',rbf_var};
d = max_ev;
basis = kpca_calc(x,kernel,d);
kpca_plot(basis);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -