fix(misc): correct docs wording and visualiser axis-count assertions#88
fix(misc): correct docs wording and visualiser axis-count assertions#88Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/CAIIVS/raitap/sessions/19498a80-3be8-4987-9d47-4c9c045ac319 Co-authored-by: stanlrt <63193889+stanlrt@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR applies small documentation wording fixes and tightens Captum image visualiser tests to assert exact Matplotlib subplot/axes layout expectations rather than permissive lower bounds.
Changes:
- Fix minor grammar/spacing issues across three documentation pages.
- Tighten Captum image visualiser tests by asserting specific
fig.axescounts for selected scenarios.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/contributor/releases.md | Fixes missing space in contributor release instructions. |
| docs/index.md | Corrects wording (“ran” → “run”) in docs homepage. |
| docs/using-raitap/installation.md | Updates Python version testing sentence to consistent present tense. |
| src/raitap/transparency/visualisers/tests/test_visualisers.py | Tightens Captum image visualiser axes-count assertions. |
| fig = visualiser.visualise(attributions) | ||
| assert fig is not None | ||
| assert len(fig.axes) >= 4 # at least one axes per sample | ||
| assert len(fig.axes) == 8 # 2 axes per sample (original + attribution) for 4 samples |
There was a problem hiding this comment.
The inline comment claims the 8 axes are from “original + attribution”, but this test calls visualise(attributions) without inputs, so the original-image panel cannot be rendered. Either pass inputs=sample_images (and update the expected axes count accordingly), or update the comment/expectation to reflect what actually creates the extra axes here (typically Captum’s per-sample colorbar axes when show_colorbar=True).
| assert len(fig.axes) == 8 # 2 axes per sample (original + attribution) for 4 samples | |
| assert len(fig.axes) == 8 # 2 axes per sample for 4 samples: attribution plot + colorbar |
| fig = visualiser.visualise(attributions, inputs=sample_images, max_samples=2) | ||
|
|
||
| assert len(fig.axes) >= 2 | ||
| assert len(fig.axes) == 2 | ||
| assert fig.axes[0].get_title() == "" |
There was a problem hiding this comment.
CaptumImageVisualiser defaults to show_colorbar=True, and in the non-paired layout Captum typically adds an extra colorbar axis per sample. With max_samples=2 this usually yields 4 axes (2 plots + 2 colorbars), so len(fig.axes) == 2 is likely incorrect/flaky. To assert exactly 2 axes, set show_colorbar=False for this test, or update the expected axes count to include the colorbar axes.
Summary
Applies six requested copy/test fixes: three documentation grammar/spacing corrections and three test assertion tightenings in Captum image visualiser tests. The test updates now validate exact subplot layout expectations instead of permissive lower bounds.
Docs wording fixes
docs/contributor/releases.md: add missing space beforetoctreeafter`going-stable-1-0`.docs/index.md: change “then ran” → “then run”.docs/using-raitap/installation.md: change “was currently tested” → “is currently tested”.Transparency visualiser test expectations
src/raitap/transparency/visualisers/tests/test_visualisers.pytest_visualise_tensor:len(fig.axes) == 8(4 samples × 2 panels).test_max_samples_limit:len(fig.axes) == 8formax_samples=4.test_can_disable_original_image_panel:len(fig.axes) == 2wheninclude_original_image=Falseandmax_samples=2.Checklist
!after the type or scope (e.g.feat!:orfeat(transparency)!:). I understand that this change will have a direct, disruptive impact on package users. I ensured that this change is absolutely necessary and cannot be delayed.Optional
Original prompt