pysolvegn.build_batch_soft_squared_regularization#

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

Build a batched soft squared regularization term (batched counterpart of build_soft_squared_regularization()).

For each problem \(k\) of the batch, the regularization is null inside the interval \([\mu_{k,i} - \tau_{k,i}, \mu_{k,i} + \tau_{k,i}]\) and increases quadratically outside this interval, with the strength \(1 / \sigma_{k,i}\).

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

Parameters:
  • means (ArrayLike) – Mean values, with shape (n,) (shared by all the problems) or (k, n).

  • thresholds (ArrayLike) – Threshold values around the corresponding means, with shape (n,) or (k, n). All values must be non-negative.

  • stds (ArrayLike) – Standard deviation values controlling the strength of the regularization outside the threshold, 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 soft squared regularization.

Return type:

BatchTerm