Skip to content

fix: CTIAgg on multi-dataset fits, and honour the input instance - #122

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/cti-database-examples-drift
Nov 5, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/cti-database-examples-drift

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Fixes ac.agg.CTIAgg for multi-dataset fits. Closes #121 (cti-upkeep phase 3).

  • Multi-dataset fits: a FactorGraphModel fit's instance holds one child per dataset, so _cti_from crashed reading instance.cti. Factor-graph fits now return a list with one CTI per dataset. Single-dataset fits still return one CTI. This is the same shape the fit aggregators already use; the human approved the return-type split.
  • Input instance (second bug, same function): object_via_gen_from ignored its instance argument. As a result randomly_drawn_via_pdf_gen_from and all_above_weight_gen_from silently returned the max-likelihood CTI for every sample. They now use each sample's own instance.
  • Refactor: _cti_list_from moves to aggregator/abstract.py, shared by the CTI and fit aggregators. The two copies were byte-identical.
  • The CTIAgg docstrings now describe the per-dataset list.

API Changes

  • CTIAgg generators yield a list of CTI objects (one per dataset) for FactorGraphModel fits. Before this change they crashed on such fits. Single-dataset fits are unchanged.
  • randomly_drawn_via_pdf_gen_from and all_above_weight_gen_from now return the drawn or above-weight samples' own CTI models, where before they repeated the max-likelihood one.

Tests

  • New: a factor-graph fit gives a list of 2 CTIs, and object_via_gen_from honours an input instance. Both fail on unchanged main.
  • test__cti_all_above_weight_gen: its first expected density changes 10.0 → 1.0. The samples_1d fixture's first sample is all 1.0 (weight 0), and the old 10.0 only held because of the ignored-instance bug.
  • Full test_autocti (serial): 279 passed.
  • Witness, with the companion autocti_workspace PR: all 9 dataset_1d results/database scripts run end-to-end against this branch, and the extended smoke list passes 6/6 under both profile_smoke and profile_release.
  • Independent review (separate-model agent): FINDINGS, LOW only.
    1. Stale docstrings: fixed in 9599788.
    2. Add models.py to smoke: declined. The new unit test covers the list behaviour directly, and the review rubric counts smoke-list growth without need as a defect.
    3. Link the PyAutoFit bug from the workspace comment: declined. It is tracked as a Mind prompt.

Tier: glance — auto-merge on green with the Witness passed (plan approved by the human 2026-11-05).

🤖 Generated with Claude Code

Jammy2211 and others added 2 commits November 5, 2026 17:15
- cti.py _cti_from: a FactorGraphModel fit's instance has one child per dataset,
  so reading instance.cti crashed. Factor-graph fits now return a list with
  one CTI per dataset; single-dataset fits still return one CTI.
- object_via_gen_from ignored its `instance` argument, so
  randomly_drawn_via_pdf_gen_from and all_above_weight_gen_from returned the
  max likelihood CTI for every sample. It now uses the input instance. The
  existing all_above_weight test asserted 10.0 for both samples, which only
  held because of this bug; it now expects each sample's own value (1.0, 10.0).
- _cti_list_from moves to aggregator/abstract.py, shared by the CTI and fit
  aggregators (the two copies were identical).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h fits (#121)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 804ddeb into main Nov 5, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/cti-database-examples-drift branch November 5, 2026 17:25
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: CTIAgg and database examples on multi-dataset (factor-graph) fits

1 participant