Add Example
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
function [x_d, hat_Q1, sigma_d] = cal_debiased_LASSO(x, A, y, lambda, sigma)
|
||||
|
||||
[M, N] = size(A);
|
||||
gamma = M/N;
|
||||
hat_Q1 = gamma;
|
||||
[~, D] = eig(A'*A);
|
||||
d = diag(D);
|
||||
|
||||
diff = 1;
|
||||
T = 1000;
|
||||
t = 0;
|
||||
|
||||
while (t < T) && (diff > 1e-6)
|
||||
|
||||
Q1_pre = hat_Q1;
|
||||
rho = mean((2 - lambda./(hat_Q1*abs(x) + lambda)).*(abs(x) > 1e-4))/2;
|
||||
hat_Q1 = rho/mean(1./(d + (1-rho)*hat_Q1/rho));
|
||||
diff = abs(Q1_pre - hat_Q1);
|
||||
t = t+1;
|
||||
|
||||
end
|
||||
|
||||
x_d = x + 1/hat_Q1*A'*(y - A*x);
|
||||
|
||||
chi = rho/hat_Q1;
|
||||
hat_Q2 = 1/chi - hat_Q1;
|
||||
|
||||
t = -hat_Q2;
|
||||
t_prime = -1/mean((1./(d+hat_Q2)).^2);
|
||||
G_prime = t + 1/chi;
|
||||
G_wprime = t_prime + 1/chi/chi;
|
||||
RSS = sum(abs(y - A*x).^2)/M;
|
||||
hat_chi = gamma*G_wprime/(2*G_prime-2*chi*G_wprime)*RSS +...
|
||||
(-G_wprime*gamma+G_prime*G_prime)/(2*G_prime-2*chi*G_wprime)*sigma^2;
|
||||
sigma_d = sqrt(2*hat_chi)/hat_Q1;
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user