Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX - computation of subdiff_distance in WeightedGroupL2 penalty #225

Conversation

Badr-MOUFAD
Copy link
Collaborator

Context of the PR

This fixes the bug reported in issue #197 (thanks for the investigation @tomaszkacprzak)

Contributions of the PR

  • fix computation of subdiff_distance
  • harden unittest

Checks before merging PR

  • [ ] added documentation for any new feature
  • added unittests
  • [ ] edited the what's new

Copy link
Collaborator

@QB3 QB3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for the quick fix @Badr-MOUFAD !
For future maintenance, maybe we could add details on the group Lasso subdifferential computation in the tutorial as well https://contrib.scikit-learn.org/skglm/tutorials/prox_nn_group_lasso.html#prox-nn-group-lasso

skglm/penalties/block_separable.py Show resolved Hide resolved
@mathurinm
Copy link
Collaborator

@Badr-MOUFAD @QB3 I'm done with the pass on docs, make any changes you want and merge

@Badr-MOUFAD
Copy link
Collaborator Author

@QB3 a glance at the derivation from you is a plus

@Badr-MOUFAD Badr-MOUFAD changed the title FIX - computation of subdiff_distance in WeightedGroupL2 penalty FIX - computation of subdiff_distance in WeightedGroupL2 penalty Mar 5, 2024

.. math::

D(v) = \min_{u \in \lambda \mathcal{B}_2, n \in \mathbb{R}_{-}^g} \ || u + n - v ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Badr-MOUFAD this hides the problem, because why is the solution for a negative v, n = 0?

I'm subjective but I find it way clearer the way it was before, which avoids reference to an external source

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Badr-MOUFAD this hides the problem, because why is the solution for a negative v, n = 0?

if v is negative, one can set n = v and u = 0 to get a distance equal zero (zero is a lower bound on the problem)

I'm subjective but I find it way clearer the way it was before, which avoids reference to an external source

The external source is a stack overflow thread to justify the computation of the min regardless of the order.

I believe the benefit of having formulas is to easily and efficiently look up the derivation later.
thought, I'm +1 for adding an explanation, that way we can have both worlds.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QB3 a glance at the derivation from you is a plus

I also think Mathurin's version was clearer. I would also try to be more self-contained (e.g. we currently talk about the distance, without always clearly stating that this is the distance of the gradient to the subdiff), but writing something clear and self-contained might take more time.

TLDR: I am happy to merge Mathurin's version and iterate later on the group lasso doc

@mathurinm mathurinm merged commit 950b523 into scikit-learn-contrib:main Mar 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants