SamplingKind#

class t3toolbox.backend.fitting.SamplingKind#

Bases: t3toolbox.backend.common.ValueHashedFields

A sampling kind: the bare J / J^T for one measurement operator, plus its reductions.

The what you measure axis of a fit. Holds the kind-specific operations the geometry-generic Gauss-Newton model needs – the bare Jacobian and its transpose (no gauge Pi: that is the geometry’s), the |.|^2 reduction over the sample stack, and the point operation S(x) used to form the residual – plus the minimal layout the default minibatch draw needs.

Built-in kinds: APPLY, ENTRIES, PROBE (module singletons) and the parameterized ProbeKind, ApplyDerivativesKind, EntriesDerivativesKind, ProbeDerivativesKind. The uniform twins are in t3toolbox.backend.uniform_fitting.

Writing your own. Subclass and supply the five operation methods; you get value identity for free provided your parameters are dataclass fields (that is the point – a kind whose parameters hide in closures cannot be compared, and silently recompiles).

name: t3toolbox.backend.common.typ.ClassVar[str] = 'sampling'#
has_order: t3toolbox.backend.common.typ.ClassVar[bool] = False#
has_block_sumsq: t3toolbox.backend.common.typ.ClassVar[bool] = False#

Methods#

precompute(frame, sample)

The reusable frame sweep at frame for sample (computed once per local model).

forward(variations, sample, frame, sweep)

The bare Jacobian J v (no gauge).

transpose(residual, sample, frame, sweep)

The bare transpose J^T r, summed over the sample stack W; raw (dU, dG).

point_forward(x_cores, sample)

The point operation S(x) -- what the residual is measured against.

take(sample, data, idx)

Gather a flat W subset of (sample, data) -- the default minibatch draw's layout hook.

w_axes(sample)

The number of leading sample-stack (W) axes.

n_measurements(sample)

The flat |W| measurement count, for the default draw.

sumsq(out, n_w)

|out|^2 over W (and the order / free-mode axes), keeping the frame stack C.

block_sumsq(out, n_w)

Per-(mode, order) |.|^2 -> a 2-D matrix; UNWEIGHTED (the honest diagnostic table).