dew.objectives.residuals
Objectives whose loss is a mean square of residuals, stepped by the gradient or by Gauss-Newton.
A physics-informed network’s loss is its equation’s residuals at its collocation points, and a
least-squares fit’s is its errors: Residuals takes each batch row’s residuals from its subclass and
trains on their mean square. A run whose optimizer is Gauss-Newton’s (dew.gauss_newton.gauss_newton,
damped as Levenberg-Marquardt’s) asks it for its residuals’ system (Step.equations): each microbatch
states its part of the update’s as statistics that pool by adding, which the trainer sums as it sums any
statistic and hands the optimizer whole, J_i^T J_i and J_i^T r_i where the update’s residuals are at least
its parameters (NormalEquations), its rows of J and r placed at its examples’ places among the update’s
where they are fewer (RowEquations). Which form an update takes is its geometry, the update’s examples
(Step.example_count) against the parameters, which the trainer gives the loss as it plans the step’s
shapes. The loss is the mean square still, its gradient its own; the optimizer steps by the solve.
| Name | Summary |
|---|---|
Residuals | An objective whose loss is the mean over its batch’s rows of the sum of each row’s squared residuals (residuals), which states its residuals’ Gauss-Newton system where its step asks for it (Step.equations, the module’s docstring). |
Residuals
Section titled “Residuals”class Residuals(Objective[Ratio | NormalEquations | RowEquations])An objective whose loss is the mean over its batch’s rows of the sum of each row’s squared
residuals (residuals), which states its residuals’ Gauss-Newton system where its step asks for it
(Step.equations, the module’s docstring).
Residuals.residuals
Section titled “Residuals.residuals”def residuals(variables: Variables, batch: Batch, step: Step) -> jax.ArrayEach row’s residuals, [B, …], every entry of a row a residual its loss squares.
Residuals.loss
Section titled “Residuals.loss”def loss( variables: Variables, batch: Batch, step: Step,) -> Ratio | NormalEquations | RowEquationsResiduals.reduce_loss
Section titled “Residuals.reduce_loss”def reduce_loss( stats: Ratio | NormalEquations | RowEquations,) -> tuple[jax.Array, jax.Array]The mean squared residual, whatever system the statistics state beside it.