kpca_test.m

来自「核主成分分析KPCA算法源码[matlab]」· M 代码 · 共 48 行

M
48
字号
% 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.mx = patterns';kernel = {'gaussian',rbf_var};d = max_ev;basis = kpca_calc(x,kernel,d);kpca_plot(basis);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?