Skip to content

fix: expose valid stored sample pairs - #1470

Merged
Jammy2211 merged 3 commits into
mainfrom
fix/valid-sample-instance-pairs
Aug 11, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
fix/valid-sample-instance-pairs

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Closes #1469.

Stage 3 exposed a historical-sample reconstruction gap in the AutoLens aggregator guide. This adds a public Samples.valid_sample_instance_pairs(...) API and delegates the aggregator implementation to it.

  • skips only points rejected by FitException
  • preserves PyAutoGalaxy's parameter guards
  • allows unrelated programming errors to propagate
  • keeps samples, instances, and weights aligned

Verification:

  • full PyAutoFit suite: 1,729 passed, 4 skipped
  • focused regression tests: 25 passed
  • exact failing Stage 3 guide passed against the release candidate wheels with this patch overlaid

Stage 3 run: https://github.com/PyAutoLabs/PyAutoHeart/actions/runs/31525583134

@Jammy2211
Jammy2211 merged commit 566ee11 into main Aug 11, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the fix/valid-sample-instance-pairs branch August 25, 2026 18:14
Jammy2211 added a commit to trexfr-ops/PyAutoFit that referenced this pull request Aug 27, 2026
…PyAutoLabs#1486)

`Samples.instances` and the shared `to_instance` decorator materialized
stored samples with no `FitException` recovery, so results written before
a model's constructor validation tightened raise from deep inside instance
construction (PyAutoFit#1486; workspace half shipped as
autogalaxy_workspace#210).

- `to_instance` gains a per-method recovery policy: `max_log_posterior`
  falls back to the next valid stored sample (mirroring the PyAutoLabs#1466
  `max_log_likelihood` guard via a shared helper); `from_sample_index`
  and the marginalized methods raise a typed `SamplesException` chained
  to the rejection, since they have no valid stored sample to substitute.
- `Samples.instances` skips rejected stored samples with a warning,
  reusing `valid_sample_instance_pairs` (PyAutoLabs#1470).
- The mode-1 rejected-final-sample hook and the updater's samples-save
  guard catch the new wrapped type.

BREAKING: reconstruction failures from `to_instance`-decorated methods
now surface as `SamplesException` instead of `ModelParameterException`.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose valid stored sample-instance pairs for guarded historical results

1 participant