TrustRegion#

class torchsim.TrustRegion(tau=0.01, anchored=False, per_voxel=True)[source]#

Bases: object

Each voxel its own damping, raised when a step does not pay.

Levenberg-Marquardt. A step is taken only where it actually lowered the residual; where it did not, the damping goes up and the step is tried again shorter. That needs the voxels to be independent, so it applies to a model with no encoding in front of it.

tau#

Sets the first damping, as this times the largest curvature the starting point shows. Small where the guess is good.

Type:

float

Methods

begin

Scale the first damping to the curvature the starting point shows.

judge

Accept where the step paid, and move the damping either way.

retire

Close up after the converged voxels have been written out.

anchored = False#

Damping shortens the step; it does not pull it anywhere.

per_voxel = True#

Each voxel carries its own weight and retires on its own.

begin(curvature)[source]#

Scale the first damping to the curvature the starting point shows.

judge(damping, gain, singular)[source]#

Accept where the step paid, and move the damping either way.

The Nielsen update: a step that predicted its own gain well lets the damping fall a long way, one that barely paid lets it fall a little, and a rejected step doubles it and doubles the doubling.

retire(keep)[source]#

Close up after the converged voxels have been written out.