0

I have used the least squares fit in the scipy.optimize package and was wondering what the second argument that is returned is?

Omid Raha
  • 9,862
  • 1
  • 60
  • 64

1 Answers1

0

The second value that is returned is what's named ier under the returns section. It's an integer code whose value means something about success or failure. I've copied the description below:

ier : int An integer flag. If it is equal to 1, 2, 3 or 4, the solution was found. Otherwise, the solution was not found. In either case, the optional output variable ‘mesg’ gives more information.

If you want to return everything from leastsq use the full_output=True argument. You can check this previous discussion for an example call. full_output=True will return all the returns listed on the documentation page

Community
  • 1
  • 1
  • Sorry I meant the cov_x term, I know it has something to do with the error on the parameter I am trying to find but I don't actually know what the value means. Cheers – user3476568 Mar 29 '14 at 21:35
  • cov_x is the covariance matrix. See for example [Wikipedia Covariance Matrix](http://en.wikipedia.org/wiki/Covariance_matrix) for a description. The diagonal terms of the covariance matrix are the variance of your fit parameters. In an ideal world where errors between quantities are not correlated the off diagonal elements would be 0. – Eric Suchyta Mar 29 '14 at 21:42
  • Ok that makes sense, so if you only have one parameter then there will only be one value? – user3476568 Mar 29 '14 at 22:48