What should leastsquares receive: residuals or already squared residuals?
MathematicsLevel: FoundationNonlinear least squares
What should least_squares receive: residuals or already squared residuals?
Hints
- Check the solver's objective.
- Avoid squaring twice.
Answer
Residuals. The solver forms a squared-residual objective internally; passing squared residuals instead creates fourth-power penalties under the default loss.
Source and licence: SciPy — nonlinear least squares · BSD-3-Clause · answer: Quantoros editorial