Question: If the design matrix is not the unit matrix for the generalized Lasso, then for x ^ ( + ) : = ( x ^

If the design matrix is not the unit matrix for the generalized Lasso, then for
x^(+):=(x^(T)x)^(-1)x^(T),tilde(y):=xx^(+)y,tilde(D):=Dx^(+), the problem reduces to mini-
mizing
(1)/(2)||tilde(y)-tilde(D)\alpha ||_(2)^(2)
Extend the functions fused_(d)ual and fused_(p)rime to fused_(d)ual_()
general and fused_(p)rime_(g)eneral, and execute the following procedure.()/()
n =20
p =10
beta = randn(p+1)
X = randn(n*p).reshape((n, p))
x_(0)= np.1nsert (x ,0, np.ones(n), ax 1s=1)
y = x_(0) beta + randn(n)
m - p -1
D =(np.eye(p)+ np.d1ag([-1]*(p-1),k-1))[:-1]
alpha, lambda_(s)eq = rused_(d)ual_(g)eneral(x, y, D)
lambda_(m)ax = np.max(1ambda_(s)eq)
alpha_(n)1n = np.min(alpha)
alpha_(n)ax = np.max(alpha)
plt.xl1n(0, lanbda_(n)ax)
plt.yl1m(alpha_(m)1n, alpha_(m)ax)
plt.xlabel(r"")
plt.ylabel()
for 1 in range(0, n):
plt.plot(lambda_(s)eq, alpha[:,1])
beta, lambda_(s)eq = rused_(p)rine_(g)eneral (x, y, D)
beta_(n)1n = np.min(beta)
beta_(n)ax = np.max(beta)
plt.xl1n(0,1anbda_(n)ax)
plt.yl1m(beta_(n)1n. beta_(m)ax)
plt.xlabel(r"")
plt.ylabel()
for 1 in range(0, p):
plt.plot(lambda_(s)eq, beta[:,1])
If the design matrix is not the unit matrix for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!