该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

有四个文件:demo.m

function [] = demo()

%This routine demonstrates an example of using LRR to do subspace segmentation. We cosntruct 5 independent subspaces, each of which has a rank of 10,

%sample 200 points of dimension 100 from each subspae, and randomly choose some points to corrupt.

[X,cids] = generate_data();

ls = [0.0001 0.0005 0.001 0.002 0.004 0.008 0.01 0.02 0.04 0.08 0.1]; %parameter lambda

rs = [];

accs=[];

for i=1:length(ls)

Z = solve_lrr(X,X,ls(i));

L = abs(Z)+abs(Z');

disp('Perfoming NCut ...');

idx = clu_ncut(L,5);

acc = compacc(idx,cids);

disp(['lambda=' num2str(ls(i)) ',seg acc=' num2str(acc)]);

rs = [rs,rank(Z,1e-3*norm(Z,2))];

accs = [accs,acc];

end

close all;

figure;

subplot(1,2,1);

plot(ls,accs);

xlabel('parameter \lambda');

ylabel('segmentation accuracy');

subplot(1,2,2);

plot(ls,rs);

xlabel('parameter \lambda');

ylabel('rank(Z)');

function [X,cids] = generate_data()

n = 200;

d = 10;

D = 100;

[U,S,V] = svd(rand(D));

cids = [];

U1 = U(:,1:d);

X = U1*rand(d,n);

cids = [cids,ones(1,n)];

for i=2:5

R = orth(rand(D));

U1 = R*U1;

X = [X,U1*rand(d,n)];

cids = [cids,i*ones(1,n)];

end

nX = size(X,2);

norm_x = sqrt(sum(X.^2,1));

norm_x = repmat(norm_x,D,1);

gn = norm_x.*randn(D,nX);

inds = rand(1,nX)<=0.3;

X(:,inds) = X(:,inds) + 0.3*gn(:,inds);

function [idx] = clu_ncut(L,K)

L = (L + L')/2;

D = diag(1./sqrt(sum(L,2)));

L = D*L*D;

[U,S,V] = svd(L);

V = U(:,1:K);

V = D*V;

idx = kmeans(V,K,'emptyaction','singleton','replicates',10,'display','off');

idx = idx';

function [acc] = compacc(Segmentation,RefSegmentation)

ngroups = length(unique(RefSegmentation));

if(size(RefSegmentation,2)==1)

RefSegmentation=RefSegmentation';

end

if(size(Segmentation,2)==1)

Segmentation=Segmentation';

end

Permutations = perms(1:ngroups);

miss = zeros(size(Permutations,1),size(Segmentation,1));

for k=1:size(Segmentation,1)

for j=1:size(Permutations,1)

miss(j,k) = sum(abs(Segmentation(k,:)-Permutations(j,RefSegmentation))>0.1);

end

end

[miss,temp] = min(miss,[],1);

acc = 1 - miss/length(Segmentation);

matlab 低秩矩阵分解,低秩分解的matlab代码看不懂,分解的两个矩阵在哪呀??...相关推荐

  1. 低秩矩阵分解 matlab,低秩分解的matlab代码看不懂,分解的两个矩阵在哪呀??...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 有四个文件:demo.m function [] = demo() %This routine demonstrates an example of us ...

  2. matlab矩阵的低秩分解,低秩分解的matlab代码看不懂,分解的两个矩阵在哪呀??...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 有四个文件:demo.m function [] = demo() %This routine demonstrates an example of us ...

  3. lrr matlab,低秩分解的matlab代码看不懂,分解的两个矩阵在哪呀??

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 有四个文件:demo.m function [] = demo() %This routine demonstrates an example of us ...

  4. matlab file(i).name,求大佬帮忙备注一下,有点看不懂,详细一点

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 fileExt = '*.bmp'; global pic_cln; global outrect; files = dir(fullfile(path, ...

  5. 编程 ,矩阵的相加c语言,VB中如何编程序以实现两个矩阵相加? 谢谢了。。。...

    满意答案 房师傅验房.. 2013.03.15 采纳率:57%    等级:12 已帮助:6468人 Public Sub add(a() As Integer, b() As Integer, c( ...

  6. 首先从键盘上两个矩阵的行数n和列数m,然后输入两个矩阵A和B的元素值,最后求出两个矩阵的和C并输出其元素值。

    输入格式: 第1行包含两个整数n和m,表示矩阵的行数和列数. 接下来n行,每行m个整数,表示矩阵A的元素值. 再接下来n行,每行m个整数,表示矩阵B的元素值. 相邻两个整数之间用空格分隔. 输出格式: ...

  7. 两个矩阵的相加和相乘

    //两个矩阵相加和相乘 public class TestMatrixOperation { public static void main(String[] args) { int [][]matr ...

  8. 机器学习——低秩矩阵分解中低秩的意义、矩阵填补、交叉验证

    在研读论文<Matrix completion by deep matrix factorization>时,遇到了一些不明白的知识点,花费了大量时间在网上查阅相关资料,终于找到了能够让自 ...

  9. 【图像重建】基于matlab字典学习KSVD图像低秩重建【含Matlab源码 1762期】

    ⛄一.低秩稀疏图像重建简介 1 矩阵的低秩稀疏分解理论 从数学上讲, 矩阵的秩反应了矩阵的固有属性, 矩阵的低秩性是指矩阵的秩相对于矩阵的行数和列数而言很小.低秩矩阵稀疏分解模型是将已知矩阵M (M∈ ...

最新文章

  1. AI实时特效,魔幻修图,Adobe Photoshop相机拯救PS菜鸟
  2. gentoo emerge安装软件
  3. 概率论-4.4 特征函数(待补充)
  4. vsftpd给root设置访问权限
  5. NodeJS学习目录
  6. pfa是什么意思_PFA的完整形式是什么?
  7. js弹出窗口关闭当前页面,而不弹出提示框
  8. python的pip_同时装了Python3和Python2,怎么用pip?
  9. freeswitch 安装 fail2ban 动态拦截IP攻击
  10. [数据结构]P1.3 栈 Stack
  11. jQuery使用手册之三 CSS操作
  12. MxNet创建ILSVRC2012.rec文件
  13. js中给html元素追加属性,用JS(JavaScript )给HTML元素增加id属性
  14. 网页头部的声明怎么写?
  15. k8s集群灾难恢复-原机器能起来
  16. 贝叶斯公式/贝叶斯法则/贝叶斯定理
  17. PDE优化|逆问题中偏微分方程约束优化的惩罚方法(Matlab代码实现)
  18. 【Linux】ps -ef 和ps aux 有什么不同呢?
  19. Android 线程4件套 MessageQueue Message Looper Handler之Looper
  20. J2EE总体的学习计划(百搜技术)

热门文章

  1. 关闭iOS软键盘的小方法
  2. 原生JavaScript---字符串[3]
  3. linux 管道和重定向
  4. 25 个超棒的 WordPress 主题(2012)
  5. Hyper-V实战:高可用性-网络规划篇(Hyper-V1.0)
  6. sql语句的一些参考
  7. 干死该死的横向滚动条
  8. linux nc命令用法举例
  9. linux deepin 升级内核命令
  10. 将harbor仓库镜像迁移至另一台harbor仓库服务器