⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_images.m

📁 toolbox_dimreduc - a toolbox for dimension reduction methods This toolbox is an educational and rec
💻 M
字号:
% test for dimension reduction on images datasets

name = 'binaryalphadigs';
name = 'umist_cropped';
name = 'edges';
name = 'disks';
name = 'frey_rawface';
name = 'digits';
name = 'olivettifaces';

options.nclass = 4;
options.nbr = 500;

if strcmp(name, 'umist_cropped')
    options.nclass = 1:5;
end
if strcmp(name, 'disks')
    options.smoothing = 0.05;
    options.dim = [64 64];
    options.nbr = 500;
end
if strcmp(name, 'edges')
    options.smoothing = 0;
    options.dim = [20 20];
    options.nbr = 25;
end

disp('-->Reading database');
M = load_images_dataset(name, options);

% turn it into a set of points
a = size(M,1);
b = size(M,2);
n = size(M,3);
X = reshape(M, a*b, n);

nn_nbr = 8;

test_type = 'hlle';
test_type = 'lle';
test_type = 'pca';
test_type = 'isomap';

disp('-->Performing dimension reduction.');
if strcmp(test_type, 'isomap')
    clear options;
    options.nn_nbr = nn_nbr;
    xy = isomap(X,2, options);
elseif strcmp(test_type, 'lle')
    nn_nbr = 16;
    xy = lle(X,nn_nbr,2);
elseif strcmp(test_type, 'hlle')
    xy = hlle(X,nn_nbr,2);
elseif strcmp(test_type, 'pca')
    [tmp,xy] = pca(X,2); xy = xy';
else
    error('Unknown method.');
end


k = 30;
clf;
plot_flattened_dataset(xy,M,k);
title(test_type);

⌨️ 快捷键说明

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