Sebastiano1991
Sebastiano1991

Reputation: 897

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

Upvotes: 3

Views: 1616

Answers (1)

Balzola
Balzola

Reputation: 476

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.

Upvotes: 2

Related Questions