Reputation: 23
Trying to perform curve-fitting on a function, using scipy curve_fit:
param_bounds=((-np.inf,-np.inf,0),(np.inf,np.inf,1))
OneCyParams, extras = curve_fit(func,xdata,ydata,bounds=param_bounds)
Resulting error:
453 if weights is None:
454 def func_wrapped(params):
--> 455 return func(xdata, *params) - ydata
456 else:
457 def func_wrapped(params):
TypeError: OneCycle() takes 2 positional arguments but 4 were given
OneCycle is the function I'm fitting.
This error goes away if I remove the bounds argument. What am I doing wrong?
Upvotes: 0
Views: 588
Reputation: 23
This error was because the relevant func only has one parameter.
Once the param_bounds was appropriately adjusted, the problem resolved.
Upvotes: 1