make_newton_display#
- t3toolbox.backend.optimizer_display.make_newton_display(problem, val_sample=None, val_data=None, print_fn=print, fmt='%.1e', record=True)#
def make_newton_display( problem, # backend.optimizers.Problem (holds the kind + full data) val_sample: typ.Any = None, # optional validation sample (same kind/layout as problem.sample) val_data: typ.Any = None, # optional validation data; both given -> a train|val table print_fn: typ.Optional[typ.Callable] = print, # where to send each iteration's text (None = silent) fmt: str = '%.1e', record: bool = True, # accumulate per-iteration records (scalars + err matrices) ) -> typ.Tuple[typ.Callable, list]: # (callback for newton_cg, records list filled as it runs)
Build a
callback(NewtonInfo)(+ itsrecordslist) that displays each Newton iteration.Precomputes the constant per-block data norms
block_sumsq(data)once (the relative-error denominators). Each call: recomputes the residual block norms, forms the train (and, ifval_datais given, validation – one extrapoint_forward, no transpose/sweep) relative-error matrices, prints viaprint_fn, and appends a self-contained record (the scalar fields +train_err/val_err). Requiresproblem.kind.block_sumsq(all built-in kinds have it).- Parameters:
val_sample (t3toolbox.backend.common.typ.Any)
val_data (t3toolbox.backend.common.typ.Any)
print_fn (t3toolbox.backend.common.typ.Optional[t3toolbox.backend.common.typ.Callable])
fmt (str)
record (bool)
- Return type:
t3toolbox.backend.common.typ.Tuple[t3toolbox.backend.common.typ.Callable, list]