AdaptationCallback¶
- class jaxrens.cli.monitor.AdaptationCallback(logger_obj)[source]¶
Bases:
objectWrites per-move adaptation data to an HDF5 trace file.
Wraps an
AdaptationLoggerand callswrite_entryon every iteration whereinfo["step_sizes_per_move"]is present. Iterations between adaptation adjustments are skipped (the info key is absent).Also surfaces two adapter-health WARNINGs to the textual log on top of the silent h5 trace:
First-hit floor warning — fires once per move the first time any replica’s bisection clamps the step size to the configured floor. Signals “the move can’t shrink further; remaining rejections are not informative for the adapter”.
Stall guard — fires once (then suppressed for
_STALL_SUPPRESS_EVENTSadjust events) when a move shows mean-trial-acceptance < 0.01 AND any replica at the floor AND no replica detecting a bracket, for_STALL_HISTORY_LENconsecutive adjust events.
- Parameters:
logger_obj (Any) – A ready-to-use
AdaptationLoggerinstance.
- on_start(ns_state, start_info=None)[source]¶
Write the mandatory iter-0 baseline row.
This pins the initial step sizes for post-hoc reconstruction: active ss at iter k = last row whose
iter <= k. Without this row, a non-full_autorun would produce an empty file (no adjustment events ever fire), and afull_autorun would mis-attribute the pre-first-adjust period to the first adjustment event’s step size.Adjustment-event-only fields (
n_rounds,cap_hits,floor_hits,converged,bracket_detected,reject_reason_counts) are written as zeros /Trueto signal “no bisection ran for this row”. Evaluation counters are zero too.Acceptance rates default to 0 here: real chain rates are absent at iter 0 (no NS step has run yet), and the trial-phase rates from bisection don’t exist either. Downstream readers should ignore acc rates on the iter-0 row.