DOC: optimize.least_squares: better name for default `loss`?
See original GitHub issueHi everybody,
And thank you all for the great job.
I’ve a question about how curve_fit() solves least squares problems when boundaries are provided.
Specifically, reading the docs here (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html) it is explicitly said:
“Use non-linear least squares to fit a function, f, to data.”
However, and please correct me if I’m wrong, if the problem involves boundaries, the function calls least_squares(), that according to the docs (https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.least_squares.html#scipy.optimize.least_squares) by default has method='trf' and loss='linear', therefore the problem is addressed as “a standard least-squares problem”.
So, if I understood correctly, by default in curve_fit() if we don’t pass an alternative loss function supported by least_squares() we are treating a case of a standard linear least squares.
If this is the case, IMHO the docs of curve_fit() would be more precise if rephrased as:
“Use linear least squares to fit a function, f, to data. Supports non-linear least squares.”
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)

Top Related StackOverflow Question
Thanks. If it comes up again, we’ll consider changing something. For now, it says “‘linear’…Gives a standard least-squares problem”, which is clear enough, whatever “linear” is supposed to refer to. So I’ll go ahead and close.
Right, every string besides
'linear'refers to the overall cost function, notrho. I think'l2'would be a better name because it follows the same convention as'soft_l1','huber', etc.Yes, that seems fine to me.
Yes, in isolation it makes sense. It just doesn’t follow the same convention as the other strings, which all describe the overall cost function. I think that’s a little confusing, although maybe it’s not worth spending the effort to change things.