Skip to content

Outlier rejection: distinguish non-finite per-sample LL from a too-aggressive rejsig #127

Closed

Description

@neuromechanist

Found in the PR #126 review (silent-failure). In both backends' _reject_outliers, a single non-finite per-sample log-likelihood (e.g. a sample driving logdet_W or an activation to +/-inf from numerical instability) makes mean/std NaN, so keep = ll >= mean - rejsig*std is all-False and the guard raises:

Outlier rejection removed all N samples (rejsig=X too aggressive for this data).

That message blames the rejsig hyperparameter when the real cause is upstream numerical instability; a user raising rejsig in response won't fix anything.

Scope

Detect non-finite entries in the per-sample LL explicitly and raise a distinct, accurate error (e.g. "K samples have non-finite log-likelihood, indicating numerical instability (singular W / overflow), not a rejsig miscalibration") before the all-rejected check.

Fix both backends together to avoid cross-backend divergence:

Not a regression from #123; the NumPy port faithfully reproduced the existing torch behavior. Low severity (needs a genuinely non-finite per-sample LL to trigger).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions