How to solve adaptive lasso in matlab?
6 views (last 30 days)
Show older comments
When I use function lasso to solve adaptive lasso, the solution path remains the same as the parameter changes. I just transform the adaptive lasso to lasso linear transformation in Zou (2006). Here is the code:
mu=[1 2 3 1.5 2.5 8 -3 -5];
sigma=[2 4 6 1 3 3.5 5.5 5];
X=zeros(100,8);
for i=1:8
X(:,i)=normrnd(mu(i),sigma(i),[100,1]);
end
epsilon=normrnd(0,1,[100,1]);
beta0=[0 0 0 2 3 0 0 5];
Y=X*beta0'+epsilon;
%%
[beta_lasso0,FitInfo0] = lasso(X,Y);
beta_OLS=(X'*X)\X'*Y;
gamma = 1;
w=abs(beta_OLS).^gamma;
w=1./w;
X_star=X./w';
[beta_lasso1,FitInfo]=lasso(X_star,Y); The
beta_Alasso1 = beta_lasso1./w;
lambda=FitInfo.Lambda;
gamma1 = 0.5;
w1=abs(beta_OLS).^gamma1;
w1=1./w1;
X_star1=X./w1';
[beta_lasso2,FitInfo1]=lasso(X_star1,Y);
beta_Alasso2 = beta_lasso2./w1;
lambda1=FitInfo1.Lambda;
0 Comments
Answers (0)
See Also
Categories
Find more on Linear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!