Solve2D: De Novo 2D Class-Average Determination¶
solve2D is the 2D equivalent of solve3D and mirrors its
methodology: one staged continuation schedule over bandwidth, search
stochasticity, and particle sampling takes uninformative references to
refined class averages. It couples ab initio 2D classification from random
references (the exploratory phase, stages 1 to 4) with initial 2D refinement
of the resulting classes (the consolidation phase, stages 5 and 6, and the
dense all-particle pass that ends the run).
Problem¶
Construct stable 2D class averages and assignments from random initialization. The alternating estimator in Refine2D converges to a local optimum. Solve2D is a continuation scheme that steers the alternation toward a good optimum by controlling three things over time: the admitted bandwidth, the amount of stochasticity in the search, and the number of particles updated per iteration.
Continuation schedule¶
The run is a sequence of refine2D stages (six by default, five when the
even/odd final stage is disabled), grouped into two phases: stages 1 to 4 are
the exploratory phase, stages 5 and 6 the consolidation phase.
Bandwidth. The low-pass limit starts coarse and halves its distance to the target each stage:
lp_start = clamp(mskdiam/12, 15, 20) A
lp_stop = clamp(mskdiam/22, 6, 8) A
lp_1 = lp_start, lp_i = lp_{i-1} - (lp_{i-1} - lp_stop)/2, lp_{n-1} = lp_stop.
The defaults scale with the mask diameter because a larger particle has more
low-frequency structure to classify on. The final stage does not fix lp at
all: it lets the band follow the class FRCs, so the last iterations match at
whatever resolution the classes have actually reached.
Search stochasticity. Stages 1 and 2 use stochastic neighborhood hill
climbing with sampled in-plane and class choices (snhc_smpl), which visits
only a random fraction of classes per particle and accepts random improvements.
From stage 3 the search switches to the probabilistic mode: each particle's
row of class likelihoods is filled in the matcher's batch and its class is one
draw from its own tempered posterior (sampling;
the class-balanced assignment was deleted on 2026-10-24).
In prob_neigh (2D's prob_neigh_mode=snhc), the intermediate stages keep that table sparse (only a
neighborhood of classes is scored per particle) and the last stage densifies it
so every particle's previous class is an explicit candidate and class-overlap
statistics are meaningful.
Particle subset. With N_active particles and a per-iteration target
nsample (default 200 000),
update_frac = min(1, nsample / N_active),
active when below 0.99. Stage 1 uses one fixed random subset for all its
iterations (sticky), so that the random references are overwritten by a
consistent population; from stage 2 the subset is redrawn every iteration,
biased toward particles with the fewest updates so coverage evens out, and
class sums are carried forward fractionally. Stage iteration
counts are stretched when update_frac is small so that each particle is
expected to be visited at least once per phase:
nits_coverage = clamp( ceil((1/update_frac - 1)/3), 1, 10 ).
Regularization. Stage 1 references are Gaussian-noise images (or random
particles, or averages of random labels), band-limited by a Gaussian at lp_1
rather than by an FRC-derived filter, with no shifts, no centering, and no ML
regularization. Any FRC between random halves would be meaningless there. From
stage 2 onward class averages are restored as MAP estimates with the
FRC-derived signal prior, and shifts are allowed up to
trs = min(5, max(2, 12 A / smpd_crop)) pixels.
Sampling grid. The whole run works on one downscaled copy of the data,
targeting 2.67 A per pixel with a minimum box of 88 pixels; the field of view
is preserved. Nothing in the schedule needs finer sampling than lp_stop.
Candidate sampling within a stage¶
In the probabilistic stages the per-particle candidate distribution over classes is
p_j = exp[-(d_j - d_min)] / sum_l exp[-(d_l - d_min)],
where d_j is the whitened Euclidean loss for class j at the seed shift,
tempered by the particle's own temperature T_i and the run's factor
prob_beta (the policy's section 3; the losses need objfun=euclid). One
candidate is drawn, keyed on the particle, its shift is refined, and the
matcher commits it as a hard assignment. The class
average is never a soft weighted sum over all candidates.
Coverage and final products¶
Fractional updates leave some particles with stale poses. After any sampled stage, the run therefore ends with a dense, greedy, all-particle pass with fractional updates off. Every active particle's class, angle, and shift is refreshed before the final class averages are restored, so the published averages and FRCs describe the assignments that accompany them.
The run publishes merged, even, and odd class stacks, per-class FRCs, ranked class products, and the per-particle assignments, scores, and noise spectra.
Rationale¶
- Coarse-to-fine bandwidth is a homotopy: at 20 A the objective is smooth and has few minima, and the solution found there is a good starting point for the sharper objective at 15 A, and so on.
- Stochastic acceptance early and greedy acceptance late is annealing. The switch to the probabilistic draw at stage 3 keeps near-ties exploring: a particle leaves its best class with the posterior's probability, which the tempering factor and its own temperature set.
- Random noise references are deliberately uninformative, so the first stage's structure comes entirely from the data.
- Fractional updates make the cost per iteration independent of dataset size; the terminal all-particle pass restores the guarantee that the final products are self-consistent.
Implementation¶
- Stage schedule:
src/main/solve/simple_solve2D_controller.f90. - Orchestration:
src/main/commanders/simple/simple_commanders_solve2D.f90. - Iteration execution:
src/main/strategies/parallelization/simple_refine2D_strategy.f90. - Class-likelihood rows and their draw:
src/main/strategies/search/probabilistic/simple_eul_prob_tab2D.f90, inside the matcher's batch pipeline (src/main/strategies/search/simple_strategy2D_matcher.f90). - Policy:
doc/policies/2D/solve2D_policy.md.