Repository: scikit-learn/scikit-learn
Pull request: DOC Provide info regarding impact of sample weights scale
<!--
Thanks for contributing a pull request! Please ensure you have taken a look at
the contribution guidelines: https://github.com/scikit-learn/scikit-learn/blob/main/CONTRIBUTING.md
-->

#### Reference Issues/PRs
<!--
Example: Fixes #1234. See also #3456.
Please use keywords (e.g., Fixes) to create link to the issues or pull requests
you resolved, so that they will automatically be closed when your pull request
is merged. See https://github.com/blog/1506-closing-issues-via-pull-requests
-->
closes https://github.com/scikit-learn/scikit-learn/issues/27285

#### What does this implement/fix? Explain your changes.
Modification of the documentation for the fit method in the Ridge class.

#### Any other comments?


<!--
Please be aware that we are a loose team of volunteers so patience is
necessary; assistance handling other issues is very welcome. We value
all user contributions, no matter how minor they are. If we are slow to
review, either the pull request needs some benchmarking, tinkering,
convincing, etc. or more likely the reviewers are simply busy. In either
case, we ask for your understanding during the review process.
For more information, see our FAQ on this topic:
http://scikit-learn.org/dev/faq.html#why-is-my-pull-request-not-getting-any-attention.

Thanks for contributing!
-->


Problem statement:
Weighted ridge regression regularization variable is dependent on sample weight magnitude
### Describe the issue linked to the documentation

When doing weighted ridge regression, the value of the regularization parameter for a particular solution is dependent on the sample weight vector due to scaling in the implementation.  Scaling should either be according to the weighted average instead of just a simple multiplication, or the documentation should specify that the weight vector should sum to 1.  This may affect other learners as well.  As is, this is unstable in a cross validation context as the data magnitude may change between folds.

### Suggest a potential alternative/fix

Specify the weight vector should sum to one, or fix the underlying behavior to avoid the dependence.

Hints from issue discussion:
It is somehow connected to https://github.com/scikit-learn/scikit-learn/issues/26848

Maybe there should be a discussion  about some general accepted way of dealing with sample weights in different algorithms ( scaling them to sum up to 1, etc)
I recall some discussion here regarding the scaling (or not) of sample-weight: https://github.com/scikit-learn/scikit-learn/issues/15657

Commit message: linting

Patch to review:
diff --git a/sklearn/linear_model/_ridge.py b/sklearn/linear_model/_ridge.py
index e39af10053c34..2b77e45bf26f7 100644
--- a/sklearn/linear_model/_ridge.py
+++ b/sklearn/linear_model/_ridge.py
@@ -1969,7 +1969,8 @@ def fit(self, X, y, sample_weight=None):
 
         sample_weight : float or ndarray of shape (n_samples,), default=None
             Individual weights for each sample. If given a float, every sample
-            will have the same weight.
+            will have the same weight. The sample_weight vector should sum to
+            one.
 
         Returns
         -------


Code review comments:
diff_hunk: @@ -1969,7 +1969,8 @@ def fit(self, X, y, sample_weight=None):
 
         sample_weight : float or ndarray of shape (n_samples,), default=None
             Individual weights for each sample. If given a float, every sample
-            will have the same weight.
+            will have the same weight. The sample_weight vector should sum to
+            one.
path: sklearn/linear_model/_ridge.py
text: @user1:
```suggestion
            will have the same weight. Note that the scale of `sample_weight`
            has an on the loss; i.e. multiplying all weights by `k`
            is equivalent to setting `alpha / k`.
```

@user2:
is word "impact" missed here? @user1