Skip to content

AMICA_NumPy long fit hits non-finite likelihood (NaN) ~iter 687 on sample data #39

Closed

Description

@neuromechanist

Surfaced while fixing #30. With the CLI save/load format fixed, test_sample_data_cli (the full 2000-iter CLI run on the sample data with sample_params.json: do_newton=true, newt_start=50) now gets past the format step but the NumPy backend diverges to a non-finite log-likelihood:

Non-finite likelihood (NaN/-inf) encountered
Optimization finished after 687 iterations

The fit stops early at ~iter 687 and the degraded result no longer Hungarian-matches the Fortran reference (correlation < 0.8), so the integration test fails on AssertionError: Some components don't match original results.

This is distinct from #30 (format) and from the parity work: at ~150 iterations the NumPy backend is stable and matches Fortran (test_sample_data_numpy_vs_fortran and the #37 NumPy<->NG parity test both pass at 150 iters, ~0.997/1.0 correlation). The instability appears only in the longer run.

Scope

  • Reproduce and localize the NaN (likely an unclipped gradient / zero-denominator / Newton-step blow-up in the long run; see .context/scratch_history.md NaN notes).
  • The torch AMICATorchNG backend runs the same update math without this blow-up on the sample data, so the NG path is a useful diff reference.
  • Once fixed, un-xfail test_sample_data_cli.

Note: AMICATorchNG (the default backend) is unaffected; this is specific to the legacy NumPy long fit.

Activity

  1. added
    bug
    on Jul 4, 2026
  2. added a commit that references this issue on Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions