Update simulator
This commit is contained in:
@@ -3,9 +3,9 @@ clc; clear; close all;
|
|||||||
|
|
||||||
trail_times = 250;
|
trail_times = 250;
|
||||||
method = "cVAMPro";
|
method = "cVAMPro";
|
||||||
Ns = [64, 128, 256, 512, 1024];
|
Ns = [128, 256, 512, 1024];
|
||||||
Ms = [4, 8, 16, 32];
|
Ms = [4, 8, 16, 32];
|
||||||
sigma = 0.01;
|
sigma = 0.1;
|
||||||
tau = 1e-6;
|
tau = 1e-6;
|
||||||
iter_max = 100;
|
iter_max = 100;
|
||||||
epi = 0;
|
epi = 0;
|
||||||
@@ -18,11 +18,11 @@ H0_REE_maxs = zeros(length(Ns), length(Ms));
|
|||||||
H1_REE_means = zeros(length(Ns), length(Ms));
|
H1_REE_means = zeros(length(Ns), length(Ms));
|
||||||
H1_REE_maxs = zeros(length(Ns), length(Ms));
|
H1_REE_maxs = zeros(length(Ns), length(Ms));
|
||||||
|
|
||||||
figure;
|
% figure;
|
||||||
|
|
||||||
for N_idx = 1: length(Ns)
|
for N_idx = 1: length(Ns)
|
||||||
for M_idx = 1: length(Ms)
|
for M_idx = 1: length(Ms)
|
||||||
subplot(length(Ns), length(Ms), (N_idx - 1) * length(Ms) + M_idx);
|
subplot(length(Ms), length(Ns), N_idx + (M_idx - 1) * length(Ns));
|
||||||
FAR_N = Ns(N_idx);
|
FAR_N = Ns(N_idx);
|
||||||
FAR_M = Ms(M_idx);
|
FAR_M = Ms(M_idx);
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ for N_idx = 1: length(Ns)
|
|||||||
[Lambda, Lambda_C, x] = get_sparse_vector(FAR_N, FAR_M, betas_wide, true);
|
[Lambda, Lambda_C, x] = get_sparse_vector(FAR_N, FAR_M, betas_wide, true);
|
||||||
|
|
||||||
% get lambda
|
% get lambda
|
||||||
signal_model_filename = "./Signal_Model/Signal_Model_" + string(FAR_N) + "_" + string(FAR_M) + ".mat";
|
signal_model_filename = "./Signal_Model_05/Signal_Model_" + string(FAR_N) + "_" + string(FAR_M) + ".mat";
|
||||||
if exist(signal_model_filename, "file")
|
if exist(signal_model_filename, "file")
|
||||||
load(signal_model_filename, "A", "C_n", "ref_lambda");
|
load(signal_model_filename, "A", "C_n", "ref_lambda");
|
||||||
else
|
else
|
||||||
@@ -68,7 +68,7 @@ for N_idx = 1: length(Ns)
|
|||||||
% train
|
% train
|
||||||
LASSO_lambda = ref_lambda;
|
LASSO_lambda = ref_lambda;
|
||||||
simulate_results_filename = ...
|
simulate_results_filename = ...
|
||||||
"./data5/" + ...
|
"./data_05/" + ...
|
||||||
"FAR" + "_" + ...
|
"FAR" + "_" + ...
|
||||||
string(FAR_N) + "_" + ...
|
string(FAR_N) + "_" + ...
|
||||||
string(FAR_M)+ "_" + ...
|
string(FAR_M)+ "_" + ...
|
||||||
@@ -99,23 +99,24 @@ for N_idx = 1: length(Ns)
|
|||||||
Lambda_distributes = zeros(2, length(Lambda) * trail_times);
|
Lambda_distributes = zeros(2, length(Lambda) * trail_times);
|
||||||
Lambda_C_distributes = zeros(2, length(Lambda_C) * trail_times);
|
Lambda_C_distributes = zeros(2, length(Lambda_C) * trail_times);
|
||||||
|
|
||||||
|
adds = [];
|
||||||
for t = 1:trail_times
|
for t = 1:trail_times
|
||||||
x_0_hat = squeeze(recovery_results(1, t, :));
|
x_0_hat = squeeze(recovery_results(1, t, :));
|
||||||
x_1_hat = squeeze(recovery_results(2, t, :)) - x;
|
x_1_hat = squeeze(recovery_results(2, t, :)) - x;
|
||||||
if anynan(x_1_hat)
|
if anynan(x_1_hat)
|
||||||
continue;
|
continue;
|
||||||
end
|
end
|
||||||
|
adds = [adds; x_1_hat];
|
||||||
|
|
||||||
for i = 1: length(Lambda) + length(Lambda_C)
|
for i = 1: length(Lambda_C)
|
||||||
if ismember(i, Lambda_C)
|
Lambda_C_distributes(1, i1) = x_0_hat(Lambda_C(i));
|
||||||
Lambda_C_distributes(1, i1) = x_0_hat(i);
|
Lambda_C_distributes(2, i1) = x_1_hat(Lambda_C(i));
|
||||||
Lambda_C_distributes(2, i1) = x_1_hat(i);
|
|
||||||
i1 = i1 + 1;
|
i1 = i1 + 1;
|
||||||
elseif ismember(i, Lambda)
|
|
||||||
Lambda_distributes(1, i2) = x_0_hat(i);
|
|
||||||
Lambda_distributes(2, i2) = x_1_hat(i);
|
|
||||||
i2 = i2 + 1;
|
|
||||||
end
|
end
|
||||||
|
for i = 1: length(Lambda)
|
||||||
|
Lambda_distributes(1, i2) = x_0_hat(Lambda(i));
|
||||||
|
Lambda_distributes(2, i2) = x_1_hat(Lambda(i));
|
||||||
|
i2 = i2 + 1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
real_H00 = real(Lambda_C_distributes(1, 1:i1-1));
|
real_H00 = real(Lambda_C_distributes(1, 1:i1-1));
|
||||||
@@ -123,14 +124,20 @@ for N_idx = 1: length(Ns)
|
|||||||
real_H10 = real(Lambda_C_distributes(2, 1:i1-1));
|
real_H10 = real(Lambda_C_distributes(2, 1:i1-1));
|
||||||
real_H11 = real(Lambda_distributes(2, 1:i2-1));
|
real_H11 = real(Lambda_distributes(2, 1:i2-1));
|
||||||
|
|
||||||
% figure;
|
if 1 == 0
|
||||||
% subplot(2, 2, 1); histfit(real_H00); xlabel("x\_hat"); ylabel("times"); title("H_0 (not in support set)")
|
figure;
|
||||||
% subplot(2, 2, 2); histfit(real_H01); xlabel("x\_hat"); ylabel("times"); title("H_0 (in support set)")
|
subplot(2, 2, 1); histfit(real_H00); xlabel("x\_hat"); ylabel("times"); title("H_0 (not in support set)")
|
||||||
% subplot(2, 2, 3); histfit(real_H10); xlabel("x\_hat"); ylabel("times"); title("H_1 (not in support set)")
|
subplot(2, 2, 2); histfit(real_H01); xlabel("x\_hat"); ylabel("times"); title("H_0 (in support set)")
|
||||||
% subplot(2, 2, 4); histfit(real_H11); xlabel("x\_hat"); ylabel("times"); title("H_1 (in support set)")
|
subplot(2, 2, 3); histfit(real_H10); xlabel("x\_hat"); ylabel("times"); title("H_1 (not in support set)")
|
||||||
% sgtitle("N = " + string(FAR_N) + ", M = " + string(FAR_M));
|
subplot(2, 2, 4); histfit(real_H11); xlabel("x\_hat"); ylabel("times"); title("H_1 (in support set)")
|
||||||
|
sgtitle("N = " + string(FAR_N) + ", M = " + string(FAR_M));
|
||||||
|
end
|
||||||
|
|
||||||
histfit(real_H11); xlabel("x\_hat"); ylabel("times"); title("N = " + string(FAR_N) + ", M = " + string(FAR_M));
|
% histfit(real_H00);
|
||||||
|
% histfit(real_H01);
|
||||||
|
% histfit(real_H10);
|
||||||
|
histfit(real_H11);
|
||||||
|
xlabel("x\_hat"); ylabel("times"); title("N = " + string(FAR_N) + ", M = " + string(FAR_M));
|
||||||
|
|
||||||
means = [ ...
|
means = [ ...
|
||||||
mean(Lambda_C_distributes(1, 1:i1-1)), ...
|
mean(Lambda_C_distributes(1, 1:i1-1)), ...
|
||||||
@@ -163,34 +170,33 @@ for N_idx = 1: length(Ns)
|
|||||||
fprintf("Test Complete \n\n");
|
fprintf("Test Complete \n\n");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sgtitle("H_1 (in support set)");
|
% sgtitle("H_0 (not in support set)")
|
||||||
|
% sgtitle("H_0 (in support set)")
|
||||||
figure;
|
% sgtitle("H_1 (not in support set)")
|
||||||
|
sgtitle("H_1 (in support set)")
|
||||||
subplot(221);
|
|
||||||
h = heatmap(Ns, Ms, H0_REE_means');
|
|
||||||
h.XLabel = "N";
|
|
||||||
h.YLabel = "M";
|
|
||||||
h.Title = "H_0, mean(REE)";
|
|
||||||
|
|
||||||
subplot(222);
|
|
||||||
h = heatmap(Ns, Ms, H0_REE_maxs');
|
|
||||||
h.XLabel = "N";
|
|
||||||
h.YLabel = "M";
|
|
||||||
h.Title = "H_0, max(REE)";
|
|
||||||
|
|
||||||
subplot(223);
|
|
||||||
h = heatmap(Ns, Ms, H1_REE_means');
|
|
||||||
h.XLabel = "N";
|
|
||||||
h.YLabel = "M";
|
|
||||||
h.Title = "H_1, mean(REE)";
|
|
||||||
|
|
||||||
subplot(224);
|
|
||||||
h = heatmap(Ns, Ms, H1_REE_maxs');
|
|
||||||
h.XLabel = "N";
|
|
||||||
h.YLabel = "M";
|
|
||||||
h.Title = "H_1, max(REE)";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
% figure;
|
||||||
|
% subplot(221);
|
||||||
|
% h = heatmap(Ns, Ms, H0_REE_means');
|
||||||
|
% h.XLabel = "N";
|
||||||
|
% h.YLabel = "M";
|
||||||
|
% h.Title = "H_0, mean(REE)";
|
||||||
|
%
|
||||||
|
% subplot(222);
|
||||||
|
% h = heatmap(Ns, Ms, H0_REE_maxs');
|
||||||
|
% h.XLabel = "N";
|
||||||
|
% h.YLabel = "M";
|
||||||
|
% h.Title = "H_0, max(REE)";
|
||||||
|
%
|
||||||
|
% subplot(223);
|
||||||
|
% h = heatmap(Ns, Ms, H1_REE_means');
|
||||||
|
% h.XLabel = "N";
|
||||||
|
% h.YLabel = "M";
|
||||||
|
% h.Title = "H_1, mean(REE)";
|
||||||
|
%
|
||||||
|
% subplot(224);
|
||||||
|
% h = heatmap(Ns, Ms, H1_REE_maxs');
|
||||||
|
% h.XLabel = "N";
|
||||||
|
% h.YLabel = "M";
|
||||||
|
% h.Title = "H_1, max(REE)";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user