2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > lle算法的matlab实现 lle算法详解及matlab代码实现

lle算法的matlab实现 lle算法详解及matlab代码实现

时间:2019-10-20 08:37:55

相关推荐

lle算法的matlab实现 lle算法详解及matlab代码实现

LLE算法代码

% LLE ALGORITHM (using K nearest neighbors)

%

% [Y] = lle(X,K,dmax)

%

% X = data as D x N matrix (D = dimensionality, N = #points)

%(D = 点的维数, N = 点数)

% K = number of neighbors(领域点的个数)

% dmax = max embedding dimensionality(最大嵌入维数)

% Y = embedding as dmax x N matrix

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%

function [Y] = lle(X,K,d)

[D,N] = size(X);

%D是矩阵的行数,N是矩阵的列数

fprintf(1,'LLE running on %d points in %d dimensions\n',N,D);

% STEP1: COMPUTE PAIRWISE DISTANCES & FIND NEIGHBORS %寻找邻居数据点

fprintf(1,'-->Finding %d nearest neighbours.\n',K);

X2 = sum(X.^2,1);

%矩阵X中的每个元素以2为指数求幂值,并且竖向相加

%if two point X=(x1,x2),Y=(y1,y2)

%than the distance between X and Y is sqtr((x1-y1) .^2+ (x2-y2).^2) distance = repmat(X2,N,1)+repmat(X2',1,N)-2*X'*X;

%repmat就是在行方向把X2复制成N份,列方向为1份

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。