Commit e8d95f75 authored by Andrey Filippov's avatar Andrey Filippov

CLAUDE: chain-rule diagnostic - RMS meas>solved pairs in the pose cycle trace

Per outer cycle: RE-MEASURED pure RMS (prepareLMA, after re-correlation) >
MODEL-PREDICTED pure RMS (runLma, after the solve). Jacobian/chain-rule error
signature (Andrey's hypothesis): solved_n low but meas_{n+1} bounces back up -
the model overpromised and re-correlation takes it back. Healthy damping:
meas_{n+1} ~ solved_n, both creep down. Zero extra computation - both values
already existed inside IntersceneLma.
Co-Authored-By: 's avatarClaude Fable 5 <noreply@anthropic.com>
parent 4ff201fa
...@@ -573,6 +573,13 @@ public class CuasPoseRT { ...@@ -573,6 +573,13 @@ public class CuasPoseRT {
double last_diff_atr = Double.NaN; // By Claude on 07/12/2026 double last_diff_atr = Double.NaN; // By Claude on 07/12/2026
final double [] cycle_datr = new double [max_cycles]; // per-cycle ATR-change trace (convergence trajectory) // By Claude on 07/12/2026 final double [] cycle_datr = new double [max_cycles]; // per-cycle ATR-change trace (convergence trajectory) // By Claude on 07/12/2026
final int [] cycle_inner = new int [max_cycles]; // inner runLma iterations per outer cycle // By Claude on 07/12/2026 final int [] cycle_inner = new int [max_cycles]; // inner runLma iterations per outer cycle // By Claude on 07/12/2026
// Chain-rule diagnostic (Andrey 07/12/2026): per cycle, the RE-MEASURED pure RMS
// (after re-correlation, from prepareLMA) vs the MODEL-PREDICTED pure RMS after
// the solve (from runLma). Jacobian/chain-rule error signature: solved_n low but
// meas_{n+1} bounces back up (the model overpromised, re-correlation "takes it
// back"). Healthy damping signature: meas_{n+1} ~ solved_n, both creep down.
final double [] cycle_rms_meas = new double [max_cycles]; // By Claude on 07/12/2026
final double [] cycle_rms_solved = new double [max_cycles]; // By Claude on 07/12/2026
int ncyc = 0; // cycles actually executed // By Claude on 07/12/2026 int ncyc = 0; // cycles actually executed // By Claude on 07/12/2026
// lean v2 (Andrey 07/12/2026): the inner LMA restarts at ilp.ilma_lambda (0.1) every // lean v2 (Andrey 07/12/2026): the inner LMA restarts at ilp.ilma_lambda (0.1) every
// outer cycle; combined with the 0.1%-improvement inner exit this under-relaxes the // outer cycle; combined with the 0.1%-improvement inner exit this under-relaxes the
...@@ -608,6 +615,7 @@ public class CuasPoseRT { ...@@ -608,6 +615,7 @@ public class CuasPoseRT {
(nlma == 0), // first_run (nlma == 0), // first_run
null, // dbg_prefix null, // dbg_prefix
clt_parameters.imp.debug_level); // debug_level clt_parameters.imp.debug_level); // debug_level
cycle_rms_meas[nlma] = intersceneLma.getLastRms()[1]; // re-measured pure RMS at this cycle's pose // By Claude on 07/12/2026
// pose_lma_debug >= 2: per-inner-step solver lines; header attributes them to // pose_lma_debug >= 2: per-inner-step solver lines; header attributes them to
// their outer cycle (the solver lines carry no scene/cycle context). // their outer cycle (the solver lines carry no scene/cycle context).
// By Claude on 07/12/2026, from Andrey's request. // By Claude on 07/12/2026, from Andrey's request.
...@@ -635,6 +643,7 @@ public class CuasPoseRT { ...@@ -635,6 +643,7 @@ public class CuasPoseRT {
last_diff_atr = diffs_atr[0]; // By Claude on 07/12/2026 last_diff_atr = diffs_atr[0]; // By Claude on 07/12/2026
cycle_datr[nlma] = diffs_atr[0]; // By Claude on 07/12/2026 cycle_datr[nlma] = diffs_atr[0]; // By Claude on 07/12/2026
cycle_inner[nlma] = lmaResult; // inner runLma iterations this cycle // By Claude on 07/12/2026 cycle_inner[nlma] = lmaResult; // inner runLma iterations this cycle // By Claude on 07/12/2026
cycle_rms_solved[nlma] = intersceneLma.getLastRms()[1]; // model-predicted pure RMS after the solve // By Claude on 07/12/2026
ncyc = nlma + 1; // By Claude on 07/12/2026 ncyc = nlma + 1; // By Claude on 07/12/2026
if ((fixed_cycles <= 0) && // lean v2: fixed count = no early exit // By Claude on 07/12/2026 if ((fixed_cycles <= 0) && // lean v2: fixed count = no early exit // By Claude on 07/12/2026
(diffs_atr[0] < clt_parameters.imp.exit_change_atr) && (diffs_atr[0] < clt_parameters.imp.exit_change_atr) &&
...@@ -661,9 +670,15 @@ public class CuasPoseRT { ...@@ -661,9 +670,15 @@ public class CuasPoseRT {
for (int i = 0; i < ncyc; i++) tsb.append(String.format(" %.3g", cycle_datr[i])); for (int i = 0; i < ncyc; i++) tsb.append(String.format(" %.3g", cycle_datr[i]));
final StringBuilder isb = new StringBuilder(); // inner runLma iterations per cycle // By Claude on 07/12/2026 final StringBuilder isb = new StringBuilder(); // inner runLma iterations per cycle // By Claude on 07/12/2026
for (int i = 0; i < ncyc; i++) isb.append(" "+cycle_inner[i]); for (int i = 0; i < ncyc; i++) isb.append(" "+cycle_inner[i]);
// meas>solved pairs: re-measured pure RMS at cycle start > model-predicted after
// the solve. Chain-rule error = the NEXT meas bounces back above this solved.
// By Claude on 07/12/2026, from Andrey's hypothesis.
final StringBuilder rsb = new StringBuilder();
for (int i = 0; i < ncyc; i++) rsb.append(String.format(" %.4f>%.4f",
cycle_rms_meas[i], cycle_rms_solved[i]));
System.out.println("CuasPoseRT cycles: scene "+scene.getImageName()+ System.out.println("CuasPoseRT cycles: scene "+scene.getImageName()+
" ("+ncyc+" of max "+max_cycles+", lambda0 "+lma_lambda+") dATR/cycle ="+tsb+ " ("+ncyc+" of max "+max_cycles+", lambda0 "+lma_lambda+") dATR/cycle ="+tsb+
"; innerLMA ="+isb); "; innerLMA ="+isb+"; RMS meas>solved ="+rsb);
} }
if (lma_rms != null) { if (lma_rms != null) {
final double [] last_rms = intersceneLma.getLastRms(); final double [] last_rms = intersceneLma.getLastRms();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment