StructuredPenaltyOperator#
- class liesel_gam.StructuredPenaltyOperator(scales, penalties, penalties_eigvalues, masks=None, validate_args=False, tol=1e-06)[source]#
Bases:
objectOperator for efficiently computing the pseudo log determinant and quadratic form of a structured tensor product precision matrix.
- Parameters:
scales (
Array) – Array of shape (B, M), where B is the batch shape and M is the number of marginal penaltiespenalties (
Sequence[Array]) – Sequence of length M, containing array of shape (B, Jm, Jm), where B is the batch shape, and Jm is the block size of the individual penalty. This block size can differ between elements of the penalty sequence.penalties_eigenvalues – Sequence of arrays of shape (B, Jm), containing the eigenvalues of the marignal penalties.
masks (
Array|None, default:None) – Boolean array of shape (B, J) where B is the batch shape andJ = prod(J1, ... JM)is the dimension of the overall precision matrix. The mask indicates the nonzero eigenvalues of the overall precision matrix, where aTrueentry means that the corresponding eigenvalue is nonzero. IfNone, will be inferred frompenalties_eigenvaluesandtolat runtime.tol (
float, default:1e-06) – Used to infermasksat runtime, ifmasks=Nonewas passed.
Methods
Shortcut for initializing the operator from marignal scales and penalties (expensive).
Efficiently computes the log pseudo-determinant of the overall precision matrix.
Materializes the full J x J overall precision matrix.
Materializes the full J x J overall precision matrix.
Efficiently computes a quadratic form
x.T @ P @ x.Attributes
Array of marginal variances (squares of marginal scales).