Sebastiano1991 - 7 months ago 51

Python Question

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)?

Answer

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.

Source (Stackoverflow)