Why can't curve_fit evaluate the covariance of a parameter if the parameter matches exactly?

I do not understand that curve_fitI can not estimate the covariance of the parameter, thereby increasing it OptimizeWarninglower. 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 = 1function exactly matches xdataand ydata. Why not error / variance 0or something close to 0, but infinstead?

This quote is in curve_fitthe 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.

, ? ?

+6
1

(Wikipedia) . ( ) - ( ), 1 - 1 = 0 . , SciPy .

xdata = [1, 2], ydata = [1, 2] ( , - : ).

, undefined, N 1 ( (N-1) ). = 1 , , .

+6

Source: https://habr.com/ru/post/1014188/


All Articles