pysolvegn.build_squared_regularization#

build_squared_regularization(means, stds)[source]#

Build a simple squared regularization of the parameters according to a Gaussian prior on the parameters, where the residuals and jacobian of the regularization are defined as:

\[R_{reg}(\lambda) = \frac{\lambda - \mu}{\sigma}\]
\[J_{reg}(\lambda) = \frac{1}{\sigma}\]

Then the callable functions returned by this function can be used as the residual and jacobian of a regularization term in the Gauss-Newton optimization, where the regularization term will be added to the residuals of the transformations, and the jacobian of the regularization will be added to the jacobian of the transformations.

Parameters:
  • means (ArrayLike) – A 1D array of mean values for each parameter. The length of the means array must be equal to the total number of parameters of all transformations.

  • stds (ArrayLike) – A 1D array of standard deviation values for each parameter. The length of the std array must be equal to the total number of parameters of all transformations.

Returns:

  • residual_func (Callable) – A function that computes the residuals of the regularization for a given set of parameters.

  • jacobian_func (Callable) – A function that computes the Jacobian of the regularization for a given set of parameters.

Return type:

Tuple[Callable, Callable]

Version#

  • 0.0.1: Initial version.