Skip to content

fix: use result.max_log_likelihood_instance for best_fit summary#34

Merged
Jammy2211 merged 1 commit into
mainfrom
fix/best-fit-accessor
May 28, 2026
Merged

fix: use result.max_log_likelihood_instance for best_fit summary#34
Jammy2211 merged 1 commit into
mainfrom
fix/best-fit-accessor

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

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

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>
@Jammy2211
Jammy2211 merged commit 327da07 into main May 28, 2026
1 check failed
@Jammy2211
Jammy2211 deleted the fix/best-fit-accessor branch May 28, 2026 14:13
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.

1 participant