3

I am trying to use the least squares solution from numpy (Description). According to the website to use the new default for the 'rcond' parameter: ''To silence the warning and use the new default, use rcond=None, to keep using the old behavior, use rcond=-1.''

With the rcond parameter set to None:

vector = np.linalg.lstsq(GA, FA, rcond = None)

It returns me an error:

TypeError: must be real number, not NoneType

Which does not happen when the parameter is taken away or set to -1.

I did some check and according to this post and one of the answers had an update stating that there were some recent changes on this method.

Then I would like to ask if someone else is having the same problem or if there is something as a typo on my line (Or something else I haven't thought about).

Kind Regards, Thanks for your time.

internet_user
  • 3,149
  • 1
  • 20
  • 29
Chicrala
  • 994
  • 12
  • 23

2 Answers2

2

You need NumPy >= 1.14. What version are you using?

Charles Harris
  • 934
  • 6
  • 4
0
 x = np.array([0, 1, 2, 3])
 y = np.array([-1, 0.2, 0.9, 2.1])
 A = np.vstack([x, np.ones(len(x))]).T
 print(A)
 m, c = np.linalg.lstsq(A, y, rcond=1.e-10)[0]
 print (m,c)
# rcond must be a float. None as in the documentation 
# gives the "TypeError: a float is required"