fix: use result.max_log_likelihood_instance for best_fit summary#34
Merged
Conversation
The previous accessor (result.samples.max_log_likelihood_sample.instance) was wrong — Sample has no .instance attribute. Surfaced as the "(unavailable: AttributeError ...)" string in every metric JSON, including the first clean A100 baseline (job 322560). result.max_log_likelihood_instance is the Result-level property that returns the model instance for the best-fit sample directly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The previous accessor used in `_runner.py` —
```python
best_instance = primary_result.samples.max_log_likelihood_sample.instance
```
is wrong: `Sample` has no `.instance` attribute. Every metric JSON written so far has serialised `best_fit` as the swallowed exception string:
```json
"best_fit": "(unavailable: AttributeError("'Sample' object has no attribute 'instance'"))"
```
This is visible in the A100 `imaging/mge × hst` baseline (job 322560) as well as both PR #29's smoke runs.
The correct accessor is the Result-level property:
```python
best_instance = primary_result.max_log_likelihood_instance
```
This matches the SLaM scripts (`result_list[0].max_log_likelihood_instance` in `autolens_workspace/scripts/multi/features/slam/independent.py`).
🤖 Generated with Claude Code