forked from SPSD3D/matrix-completion-data-imputation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP2_analyzerank_v2.m
83 lines (75 loc) · 1.56 KB
/
P2_analyzerank_v2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
clc;
clear;
close all;
datasetid=50;
datatimeseriesfolder=['CSV/'];
dataset=['ProcessedDataset' sprintf('%03d',datasetid) '/' ];
file='initial.csv';
Din=csvread([datatimeseriesfolder dataset file]);
%Din=Din-mean(mean(Din));
D=Din;
numel(D);
% subplot(1,2,1)
[U,Sd,V]=svd(D);
SD=diag(Sd);
SDP=SD/sum(SD);
figure(3)
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 16 10])
bar(SDP);
xlabel('Component') % x-axis label
ylabel('Singular value') % y-axis label
set(gca,'FontSize',36)
%plot(SDP,'LineWidth',3);
grid on
print(['Figures/' num2str(datasetid) '-singular.png'],'-dpng','-r100')
SDPC=[];
for i=1:length(SDP)
SDPC(i)=sum(SDP(1:i));
end
%subplot(1,2,2)
figure(4)
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 16 10])
bar(SDPC);
xlabel('Number of components') % x-axis label
ylabel('Sum of singular values') % y-axis label
set(gca,'FontSize',36)
ylim([0 1])
%plot(SDPC,'LineWidth',3);
grid on
set(findall(gcf,'-property','FontSize'),'FontSize',36)
print(['Figures/' num2str(datasetid) '-singular-sum.png'],'-dpng','-r100')
% figure(6)
% X=max(size(D,1),size(D,2));
% Xopt=X;
% Opt=D;
% Circ=0;
% for j=1:numel(D)
% D=circularshift(D);
% [U,Sd,V]=svd(D);
% SD=diag(Sd);
% SDP=SD/sum(SD);
% SDPC=[];
% for i=1:length(SDP)
% SDPC(i)=sum(SDP(1:i));
% end
% Xcur=numel(find(SDPC(SDPC<0.85)));
%
% if Xcur<Xopt
% Xopt=Xcur;
% Opt=D;
% Circ=j;
% end
% end
%
% [U,Sd,V]=svd(Opt);
% SD=diag(Sd);
% SDP=SD/sum(SD);
% plot(SDP,'LineWidth',3);
% grid on
% hold on
% [U,Sd,V]=svd(Din);
% SD=diag(Sd);
% SDP=SD/sum(SD);
% plot(SDP,'LineWidth',2);
% grid on
% hold off