forked from jieshen-sjtu/OnlineLRR-ICML2016
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathev_samples_gen_data.m
55 lines (41 loc) · 1.33 KB
/
ev_samples_gen_data.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
clear;
config = ev_samples_config();
p = config.p;
n = config.n;
all_n = config.all_n;
all_dd = config.all_d;
all_rho = config.rho;
all_rep = config.repetitions;
K = config.K;
end_idx = cumsum(all_n);
start_idx = end_idx - all_n + 1;
gt_org = zeros(n, 1);
for kidx=1:K
gt_org(start_idx(kidx):end_idx(kidx)) = kidx;
end
for k=8%1:length(all_rep)
rep = all_rep(k);
fprintf('Generate data for rep: %d\n', rep);
for i=3:4%:length(all_rho)
rho = all_rho(i);
for j=1:size(all_dd, 2)
all_d = all_dd(:, j);
rank = config.d(j);
[U, V, E] = gen_union_subspace(p, all_d, all_n, rho);
Z = zeros(p, n);
for kidx=1:K
Z(:, start_idx(kidx):end_idx(kidx)) = U{kidx} * V{kidx}';
end
Z = Z + E;
for zidx=1:size(Z,2)
Z(:, i) = Z(:, i) / norm(Z(:, i));
end
perm = randperm(n);
Z = Z(:, perm);
gt = gt_org(perm);
data_file = sprintf(config.data_file_format, rank, rho, rep);
save(data_file, 'U', 'V', 'E', 'Z', 'gt', '-v7.3');
fprintf('write data to %s\n', data_file);
end
end
end