diff options
author | Mike Jarvis <michael@jarvis.net> | 2021-06-08 07:41:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-08 14:41:59 +0300 |
commit | 5c4aac16b54284a59bc5af34e731be7299cbb1d1 (patch) | |
tree | e3310251db564f44e9b18e77402955c6a2c4632e /numpy/polynomial/hermite.py | |
parent | 8f1eff4d9b09741d1e989e8118d67af4de7990c5 (diff) | |
download | numpy-5c4aac16b54284a59bc5af34e731be7299cbb1d1.tar.gz |
DOC: Adjust polyfit doc to clarify the meaning of w (#18421)
* DOC: Adjust polyfit doc to clarify the meaning of w
cov='unscaled', in particular, had inconsistently referred to a weight
of 1/sigma**2, while the doc for w says it should be equal to 1/sigma.
This change clarifies w to comport with more typical meanings of
weights in weighted least squares, and makes clear that cov='unscaled'
is appropriate when the weight w**2 = 1/sigma**2.
See Issue #5261 for more discussion of the errors/confusion in
the previous doc string.
* Update doc text for w in all polynomial module fit functions
Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Diffstat (limited to 'numpy/polynomial/hermite.py')
-rw-r--r-- | numpy/polynomial/hermite.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py index eef5c25b2..c1b9f71c0 100644 --- a/numpy/polynomial/hermite.py +++ b/numpy/polynomial/hermite.py @@ -1310,10 +1310,11 @@ def hermfit(x, y, deg, rcond=None, full=False, w=None): default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. w : array_like, shape (`M`,), optional - Weights. If not None, the contribution of each point - ``(x[i],y[i])`` to the fit is weighted by ``w[i]``. Ideally the - weights are chosen so that the errors of the products ``w[i]*y[i]`` - all have the same variance. The default value is None. + Weights. If not None, the weight ``w[i]`` applies to the unsquared + residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are + chosen so that the errors of the products ``w[i]*y[i]`` all have the + same variance. When using inverse-variance weighting, use + ``w[i] = 1/sigma(y[i])``. The default value is None. Returns ------- |