相当于cov_x from(传统)scipy.optimize.leatsq在scipy.optimize.最小二乘法

2024-04-19 17:57:26 发布

您现在位置:Python中文网/ 问答频道 /正文

旧的scipy.optimize.leastsq函数返回一个cov_x参数:

cov_x: ndarray

Uses the fjac and ipvt optional outputs to construct an estimate of the jacobian around the solution. None if a singular matrix encountered (indicates very flat curvature in some direction). This matrix must be multiplied by the residual variance to get the covariance of the parameter estimates – see curve_fit.

用于估计参数估计的方差。在

这个参数在新的scipy.optimize.least_squares中的等价物是什么?有:

jac : ndarray, sparse matrix or LinearOperator, shape (m, n)

Modified Jacobian matrix at the solution, in the sense that J^T J is a Gauss-Newton approximation of the Hessian of the cost function. The type is the same as the one used by the algorithm.

但这并不是真正的等价物。在


Tags: oftheto函数in参数byis
1条回答
网友
1楼 · 发布于 2024-04-19 17:57:26

我不认为有明显的对应。jac不一样。它是雅可比矩阵的估计,雅可比矩阵是用来计算梯度的导数,用来优化最小结果。在

您可以使用^{}执行最小二乘回归,这将返回协方差矩阵。在

Returns:

popt : array Optimal values for the parameters so that the sum of the squared residuals of f(xdata, *popt) - ydata is minimized

pcov : 2d array The estimated covariance of popt. The diagonals provide the variance of the parameter estimate. To compute one standard deviation errors on the parameters use perr = np.sqrt(np.diag(pcov)). How the sigma parameter affects the estimated covariance depends on absolute_sigma argument, as described above. If the Jacobian matrix at the solution doesn’t have a full rank, then ‘lm’ method returns a matrix filled with np.inf, on the other hand ‘trf’ and ‘dogbox’ methods use Moore-Penrose pseudoinverse to compute the covariance matrix.

另请参见^{},它也做最小二乘法,并返回与协方差相关的相关系数。在

相关问题 更多 >