Residuals
popinn.ResidualTerm
¤
Module for evaluating a residual function over a grid of coordinate and auxiliary values, then reducing the residual grid to a scalar value with a specified metric.
Source code in src/popinn/loss.py
__init__(name, residual_fn, metric='mse', eval_fn=eval_grid, batch_size=None)
¤
.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the term. Should match the name of a coordinate field in the |
required |
residual_fn
|
collections.abc.Callable
|
Function with the signature
|
required |
metric
|
str | collections.abc.Callable
|
Metric to compute the loss. Can be 'mse' for mean-squared-err, 'mae' for mean-absolute-error, or a custom Callable mapping a grid of values to a scalar. |
'mse'
|
eval_fn
|
popinn.eval.eval_grid | popinn.eval.eval_grid_flat_aux
|
Function that evaluates the model over a grid of coordinates
and auxiliary inputs. Can be |
popinn.eval.eval_grid
|
batch_size
|
int | None
|
The batch sizes for the
memory dial in |
None
|
__call__(model, data)
¤
Evaluate the residual over this term's coordinate and auxiliary grid and reduce to a scalar.
Coordinates are read from data.<name>_coords (where <name> is the
name specified at initialization) and the auxiliary
inputs from data.aux.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
popinn.models.AbstractModel
|
The network model. |
required |
data
|
equinox.Module
|
data container with field carrying the 1D coordinate |
required |
Returns:
| Type | Description |
|---|---|
jaxtyping.Float[jax.Array, '']
|
the scalar loss for this term. |