core.Prior
core.Prior()Anything that can be the prior of a Laplace update.
Methods
| Name | Description |
|---|---|
| add_precision_to | The operator plus the prior’s precision \(\Lambda_0\). |
| location | The prior’s mean, shaped like like. |
| log_prob | Log density of the prior at params. |
add_precision_to
core.Prior.add_precision_to(op, /)The operator plus the prior’s precision \(\Lambda_0\).
A Laplace update calls it on the scaled curvature to form the posterior precision (see LaplacePosterior).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| op | Op | A precision operator. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Op | An operator of the same type, \(\text{op} + \Lambda_0\). |
Raises
| Name | Type | Description |
|---|---|---|
| StructureError | Implementations raise it when the operator’s structure can’t hold their precision. |
location
core.Prior.location(like, /)The prior’s mean, shaped like like.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| like | Params | Parameter mapping whose names, shapes, dtypes and devices the mean must have. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Params | The mean, a parameter mapping. |
Raises
| Name | Type | Description |
|---|---|---|
| StructureError | Implementations raise it when their mean doesn’t match like (see check_location). |
log_prob
core.Prior.log_prob(params, /)Log density of the prior at params.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| params | Params | Parameter mapping with the prior’s keys and shapes. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Tensor | A 0-dim tensor, \(\log p(\theta)\). |