资源简介
Sparse Subspace Clustering :Algorithm Theory and applications 的论文和matlab实现
代码片段和文件信息
%--------------------------------------------------------------------------
% This function takes a DxN matrix of N data points in a D-dimensional
% space and returns a NxN coefficient matrix of the sparse representation
% of each data point in terms of the rest of the points
% Y: DxN data matrix
% affine: if true then enforce the affine constraint
% thr1: stopping threshold for the coefficient error ||Z-C||
% thr2: stopping threshold for the linear system error ||Y-YZ||
% maxIter: maximum number of iterations of ADMM
% C2: NxN sparse coefficient matrix
%--------------------------------------------------------------------------
% Copyright @ Ehsan Elhamifar 2012
%--------------------------------------------------------------------------
function C2 = admmLasso_mat_func(YaffinealphathrmaxIter)
if (nargin < 2)
% default subspaces are linear
affine = false;
end
if (nargin < 3)
% default regularizarion parameters
alpha = 800;
end
if (nargin < 4)
% default coefficient error threshold to stop ADMM
% default linear system error threshold to stop ADMM
thr = 2*10^-4;
end
if (nargin < 5)
% default maximum number of iterations of ADMM
maxIter = 200;
end
if (length(alpha) == 1)
alpha1 = alpha(1);
alpha2 = alpha(1);
elseif (length(alpha) == 2)
alpha1 = alpha(1);
alpha2 = alpha(2);
end
if (length(thr) == 1)
thr1 = thr(1);
thr2 = thr(1);
elseif (length(thr) == 2)
thr1 = thr(1);
thr2 = thr(2);
end
N = size(Y2);
% setting penalty parameters for the ADMM
mu1 = alpha1 * 1/computeLambda_mat(Y);
mu2 = alpha2 * 1;
if (~affine)
% initialization
A = inv(mu1*(Y‘*Y)+mu2*eye(N));
C1 = zeros(NN);
Lambda2 = zeros(NN);
err1 = 10*thr1; err2 = 10*thr2;
i = 1;
% ADMM iterations
while ( err1(i) > thr1 && i < maxIter )
% updating Z
Z = A * (mu1*(Y‘*Y)+mu2*(C1-Lambda2/mu2));
Z = Z - diag(diag(Z));
% updating C
C2 = max(0(abs(Z+Lambda2/mu2) - 1/mu2*ones(N))) .* sign(Z+Lambda2/mu2);
C2 = C2 - diag(diag(C2));
% updating Lagrange multipliers
Lambda2 = Lambda2 + mu2 * (Z - C2);
% computing errors
err1(i+1) = errorCoef(ZC2);
err2(i+1) = errorLinSys(YZ);
%
C1 = C2;
i = i + 1;
end
fprintf(‘err1: %2.4f err2: %2.4f iter: %3.0f \n‘err1(end)err2(end)i);
else
% initialization
A = inv(mu1*(Y‘*Y)+mu2*eye(N)+mu2*ones(NN));
C1 = zeros(NN);
Lambda2 = zeros(NN);
lambda3 = zeros(1N);
err1 = 10*thr1; err2 = 10*thr2; err3 = 10*thr1;
i = 1;
% ADMM iterations
while ( (err1(i) > thr1 || err3(i) > thr1) && i < maxIter )
% updating Z
Z = A * (mu1*(Y‘*Y)+mu2*(C1-Lambda2/mu2)+mu2*ones(N1)*(ones(1N)-lambda3/mu2));
Z = Z - diag(diag(Z));
% updating C
C2 = max(0(abs(Z+Lambda2/mu2) - 1/mu2*ones(N))) .* sign(Z+Lambda2/mu2);
C2 = C2 - diag(diag(C2));
% updating Lagrange multi
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6148 2012-10-03 01:46 SSC_ADMM_v1.1\SSC_ADMM_v1.1\.DS_Store
文件 3427 2012-10-05 00:01 SSC_ADMM_v1.1\SSC_ADMM_v1.1\admmLasso_mat_func.m
文件 3980 2012-10-05 00:03 SSC_ADMM_v1.1\SSC_ADMM_v1.1\admmOutlier_mat_func.m
文件 969 2012-10-02 01:49 SSC_ADMM_v1.1\SSC_ADMM_v1.1\BuildAdjacency.m
文件 678 2012-10-02 01:43 SSC_ADMM_v1.1\SSC_ADMM_v1.1\computeLambda_mat.m
文件 733 2012-10-04 23:58 SSC_ADMM_v1.1\SSC_ADMM_v1.1\DataProjection.m
文件 548 2012-10-02 01:43 SSC_ADMM_v1.1\SSC_ADMM_v1.1\errorCoef.m
文件 825 2012-10-02 01:43 SSC_ADMM_v1.1\SSC_ADMM_v1.1\errorLinSys.m
文件 580 2012-10-03 12:30 SSC_ADMM_v1.1\SSC_ADMM_v1.1\matrixNormalize.m
文件 747 2012-10-02 01:43 SSC_ADMM_v1.1\SSC_ADMM_v1.1\Misclassification.m
文件 1099 2012-10-02 01:41 SSC_ADMM_v1.1\SSC_ADMM_v1.1\missclassGroups.m
文件 17712 2012-10-05 00:26 SSC_ADMM_v1.1\SSC_ADMM_v1.1\readme.pdf
文件 1558 2012-10-05 00:25 SSC_ADMM_v1.1\SSC_ADMM_v1.1\readme.rtf
文件 1362 2012-10-05 00:08 SSC_ADMM_v1.1\SSC_ADMM_v1.1\run_SSC_Faces.m
文件 2863 2012-10-05 00:28 SSC_ADMM_v1.1\SSC_ADMM_v1.1\run_SSC_MS.m
文件 1218 2012-10-02 01:40 SSC_ADMM_v1.1\SSC_ADMM_v1.1\SpectralClustering.m
文件 1189 2012-10-04 23:59 SSC_ADMM_v1.1\SSC_ADMM_v1.1\SSC.m
文件 680 2012-10-03 01:04 SSC_ADMM_v1.1\SSC_ADMM_v1.1\thrC.m
文件 8018017 2012-06-29 16:19 SSC_ADMM_v1.1\SSC_ADMM_v1.1\YaleBCrop025.mat
文件 82 2012-10-03 01:46 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._.DS_Store
文件 82 2012-10-05 00:01 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._admmLasso_mat_func.m
文件 82 2012-10-05 00:03 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._admmOutlier_mat_func.m
文件 717 2012-10-02 01:49 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._BuildAdjacency.m
文件 720 2012-10-02 01:43 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._computeLambda_mat.m
文件 369 2012-10-04 23:58 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._DataProjection.m
文件 712 2012-10-02 01:43 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._errorCoef.m
文件 714 2012-10-02 01:43 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._errorLinSys.m
文件 718 2012-10-03 12:30 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._matrixNormalize.m
文件 720 2012-10-02 01:43 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._Misclassification.m
文件 718 2012-10-02 01:41 SSC_ADMM_v1.1\__MACOSX\SSC_ADMM_v1.1\._missclassGroups.m
............此处省略15个文件信息
评论
共有 条评论