Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is optimality in scipy.least_squares

Hello I have a quick question concerning the terminology used in https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.least_squares.html .
They define optimality : float

First-order optimality measure. In unconstrained problems, it is always the uniform norm of the gradient. In constrained problems, it is the quantity which was compared with gtol during iterations.

Is this what I have gotten to know as reduced chi square = (chi^2/DoF)?

like image 291
Sebastiano1991 Avatar asked Jan 29 '26 01:01

Sebastiano1991


1 Answers

I would say: no. The quantity you are looking for may be (not clear in your question):

np.sum(np.square(fun))/fun.shape[0]

fun being the third return value (residuals) of scipy.optimize.least_squares. The residuals will give you an idea of the spread of your data, whereas optimality will be always be close to zero, provided the solver converged.

like image 199
Balzola Avatar answered Jan 31 '26 18:01

Balzola