-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_synthetic.m
71 lines (62 loc) · 1.42 KB
/
run_synthetic.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
clc;close all
state = 0;
rng('default');
% addpath(genpath('~DRL/'));
if 1
%% synthetic data
N = 65;
T = 6;
A = zeros(N, N, T);
B = cell(1, T);
bd = [0 10 30 65];
C = numel(bd) -1;
t = 1;
for cc = 1:C
dex = bd(cc)+1:bd(cc+1);
A(dex, dex, t) = 1;
A(:, :, t) = A(:, :, t) - diag(diag(A(:, :, t)));
B{t} = sparse(A(:, :, t));
end
subplot(T, 4, (t-1)* 4 + 1);imagesc(A(:,:,t));
for t = 2:T
if t == 2
bd = [0 15 25 35 65];
elseif t == 3
bd = [0 18 30 44 65];
else
bd = bd + [0 5 5 0];
end
C = numel(bd) -1;
for cc = 1:C
dex = bd(cc)+1:bd(cc+1);
A(dex, dex, t) = 1;
A(:, :, t) = A(:, :, t) - diag(diag(A(:, :, t)));
B{t} = sparse(A(:, :, t));
end
subplot(T, 4, (t-1)* 4 + 1);imagesc(A(:,:,t));
if t == 2
bd = [0 15 35 65];
elseif t == 3
bd = [0 20 40 65];
end
end
options.burnin = 2000;
options.mcmcsamps = 1000;
options.display = 1;
Acore = B;
TrainRatio = 1;
numslices = T;
idx_train = cell(numslices, 1); idx_test = cell(numslices, 1); BTrain_Mask = cell(numslices, 1);
figure(1);
for t = 1:numslices
[idx_train{t}, idx_test{t}] = Create_Mask_big_network(Acore{t}, TrainRatio);
end
options.TrainRatio = TrainRatio;
options.idx_train = idx_train;
options.idx_test = idx_test;
numrep = 1;result = cell(numrep, 1);
options.Mex = 1;
for rep = 1:numrep
result{rep} = HGPDR_batch_Gibbs(B, options);
end
end