The scipy function scipy.optimize import curve_fit
can fit 1D functions and returns popt
(Optimal values for the parameters) and pcov
(the estimated covariance of popt).
There are also packages to fit multidimensional functions like sklearn (see this post). However there is no estimated covariance for the parameters.
Is there any way to get the parameters and the corresponding errors with python?
Example code:
x = ...
y = ...
def f(x, a, b, c, d, e):
return a*x[0] + b*x[1] + c*x[2] + d*x[3] + e*x[4]
fit = fit(f, x, y)