Ex. 17.8
Ex. 17.8
(a) Write a program to fit the lasso using the coordinate descent procedure (17.26). Compare its results to those from the lars program or some other convex optimizer, to check that it is working correctly.
(b) Using the program from (a), write code to implement the graphical lasso (Algorithm 17.2). Apply it to the flow cytometry data from the book website. Vary the regularization parameter and examine the resulting networks.
Soln. 17.8
We've already implemented Algorithm 17.1 in Ex. 17.7. The graphical lasso implementation only needs two minor changes on top of that. The first is the initialization of \(\bb{W} = \bb{S} + \lambda \bb{I}\). The second is in step 2 (b), instead of solving \(\beta\) using ordinary least squares, we use Lasso instead.
For this exercise, we will reuse the GraphicalLasso module in sklearn.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|