Adapting step_size and sag updates for sample_weight #31837
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Helper for PR #31675 to fix sample_weight support in SAG(A) solvers #31536.
What does this implement/fix? Explain your changes.
In test_sag.py several fixes are made to properly handle sample_weight.
get_step_size
: the formula Lipschitz smoothness constant are corrected to take into account sample_weightsag
: the updates for the weights and intercept are correctedsag
: the number of seen elements (which converges ton_samples
) is replaced by the weighted sum of seen elements (which converges tosample_weight.sum()
)A
true_weights
argument was added tosag
for visualisation purpose (plot the convergence towards the true minima). This is useful for the notebook below but can be removed in the final PR. Atol
argument was also added to use the same stopping criterion as_sag_fast.pyx
.cc @snath-xoc