日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

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

發布時間:2025/3/11 循环神经网络 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 低秩矩阵分解 matlab,低秩分解的matlab代码看不懂,分解的两个矩阵在哪呀??... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規已被系統折疊?隱藏此樓查看此樓

有四個文件: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代码看不懂,分解的两个矩阵在哪呀??...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。