pysolvegn.build_batch_squared_regularization#

build_batch_squared_regularization(means, stds, *, weight=1.0, loss=None, loss_scale=1.0)[source]#

Build a batched squared regularization term based on a Gaussian prior (batched counterpart of build_squared_regularization()).

For each problem \(k\) of the batch:

\[r_{\mathrm{reg},k,i}(\mathbf{p}_k) = \frac{p_{k,i} - \mu_{k,i}}{\sigma_{k,i}}\]

The resulting BatchTerm can be directly passed to pysolvegn.solve_batch().

Parameters:
  • means (ArrayLike) – Mean values of the Gaussian prior, with shape (n,) (same prior for all the problems) or (k, n) (one prior per problem).

  • stds (ArrayLike) – Standard deviation values of the Gaussian prior, with shape (n,) or (k, n). All values must be strictly positive.

  • weight (Union[Real, ArrayLike] (default=1.0)) – Weight of the regularization term: a scalar or one weight per problem with shape (k,) (see pysolvegn.BatchTerm).

  • loss (Optional[Union[str, Callable]] (default=None)) – Loss function applied to the regularization residuals.

  • loss_scale (Real (default=1.0)) – Soft threshold of the loss function, in the unit of the residuals (number of standard deviations), see pysolvegn.BatchTerm.

Returns:

A BatchTerm representing the squared Gaussian regularization.

Return type:

BatchTerm