📄 mappinganalysis.m
字号:
%=====================================================================%% MappingAnalysis% ----------------%% Parameters: % Samples - This matrix holds the data points.
% R - The minimal sphere's radius.% beta - The vector of the Lagrangian multipliers.
% quad - The quadratic part of the distace from the sphere's
% center.
% q - The width of the gaussian kernel.%% Return Value:% grids - Each layer in this matrix holds a grid mapping for % - a couple of dimensions.% grids_sizes - The number of points in each grid layer.% % Maps the sphere to a 2 dimentional data space, The sphere is separately% mapped to all possible couples of dimensions.%=====================================================================function [grids, grids_sizes] = MappingAnalysis(Samples,R,beta,quad,q)[attr,N] = size(Samples);min_sample = min(Samples');
max_sample = max(Samples');% the grid size is 31 points in each dimension, varying from max to min.jump = (max_sample - min_sample)./30;grids_size = 0;grids = zeros(31*31,2,attr*attr);% seperate to all possible 2D spaces.for attr1 = 1:attr-1 for attr2 = attr1+1:attr x = [min_sample(attr1):jump(attr1):max_sample(attr1)]; y = [min_sample(attr2):jump(attr2):max_sample(attr2)]; xnum = length(x); ynum = length(y);
grid_2d = zeros(xnum*ynum,2); grid_size = 0; % maps the sphere into the current 2D space. for i = 1:ynum for j = 1:xnum z = [x(j);y(i)]; d = DistFromCenter([Samples(attr1,:);Samples(attr2,:)],N,beta,q,z) + quad; if d < R
grid_size = grid_size + 1; grid_2d(grid_size,:) = z'; end end end grids_size = grids_size +1; grids(:,:,grids_size) = grid_2d; grids_sizes(grids_size) = grid_size; endend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -