How to get sparsity in individual columns in coef_ in a LASSO model?

38 views Asked by At

So I want to get sparse coefficients after training a LASSO model but I want the sparsity to be maintained on each column of the coefficients.

Suppose after training sklearn.linear_model.Lasso with 5 input dimension and 3 output dimension I get the following coeff _ :

array([[ 1.87666825 ,  0.        , -1.37516633,  0.57491936, -0.65120491],
       [ 0.         , -0.5901364 , -0.85214947,  0.03498916, -0.81805396],
       [ -0.89515717, -0.04372684, -0.22986802,  0.        , -0.56785277]])

Is it possible to get sparsity on a particular column? For example:


array([[ 0.        ,  1.87666825, -1.37516633,  0.57491936, -0.65120491],
       [ 0.        , -0.5901364 , -0.85214947,  0.03498916, -0.81805396],
       [ 0.        , -0.04372684, -0.22986802, -0.89515717, -0.56785277]])
0

There are 0 answers