Open BalzaniEdoardo opened 10 months ago
If I can add to this discussion as a user: it would be very convenient for me to be able to apply GroupLasso to my Pytree and specify the groups (trough the mask) using feature labels instead of having to generate a mask by hand.
As of now, the group Lasso regularizer is not compatible with pytrees, but only with arrays. The fundamental difference is that when we pass a model matrix in array format, parameters are grouped based on column indices; on the other hand, when we pass pytree parameters, groups are given by the dictionary structure itself, (i.e. params["group_1"], ... , params["group_n"], are the different groups).
We need to discuss if and how to maintain compatibility with both pytrees and arrays for group Lasso. Below an implementation of the group Lasso operator that works with pytrees only:
this is a proximal operator that is equivalent to the original implementation that works with pytrees parameters. It assumes a tree representation of the regularizer, which could be more flexible for cases in which we want to have a regularizer strength that is variable specific.
A test that checks the equivalence between the pytree-based and array based implementation is the following: