test_nearest_neighboors.m

来自「toolbox_dimreduc - a toolbox for dimensi」· M 代码 · 共 19 行

M
19
字号
% test for computations of nn

name = 'swissroll';
n = 3000;
options.sampling = 'rand';
[X,col] = load_points_set( name, n, options );
nbr_nn = 50;

options.use_nntools = 0;
[D1,nn_list1] = compute_nn_distance(X,nbr_nn, options);
options.use_nntools = 1;
[D2,nn_list2] = compute_nn_distance(X,nbr_nn, options);

disp( ['Error (should be 0)=' num2str(norm(D1-D2) + norm(nn_list1-nn_list2),2) '.'] );

L = nn_list1(1,:);
col(L) = 2;

plot_scattered(X,col);

⌨️ 快捷键说明

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