I do not understand that curve_fit
I can not estimate the covariance of the parameter, thereby increasing it OptimizeWarning
lower. The following MCVE explains my problem:
fragment of the MCVE icon
from scipy.optimize import curve_fit
func = lambda x, a: a * x
popt, pcov = curve_fit(f = func, xdata = [1], ydata = [1])
print(popt, pcov)
Exit
\python-3.4.4\lib\site-packages\scipy\optimize\minpack.py:715:
OptimizeWarning: Covariance of the parameters could not be estimated
category=OptimizeWarning)
[ 1.] [[ inf]]
For the a = 1
function exactly matches xdata
and ydata
. Why not error / variance 0
or something close to 0
, but inf
instead?
This quote is in curve_fit
the SciPy Reference Guide :
If the Jacobian matrix in the solution does not have a full rank, then the lm method returns a matrix filled with np.inf, on the other hand, the trf and dogbox methods use the Moore-Penrose pseudo-mode to calculate the covariance matrix.
, ? ?