Skip to content

fix(core): report output_dim, not min_output_dim, when it is too small - #44

Open
ChrisW09 wants to merge 1 commit into
mainfrom
fix/floor-error-names-output-dim
Open

fix(core): report output_dim, not min_output_dim, when it is too small#44
ChrisW09 wants to merge 1 commit into
mainfrom
fix/floor-error-names-output-dim

Conversation

@ChrisW09

Copy link
Copy Markdown
Collaborator

Fixes #38.

Problem

AdaptiveResolutionMixin._resolve_output_bounds reported every floor violation against
min_output_dim, but lo is assigned output_dim on the non-adaptive branch a few lines
earlier. So a user who set output_dim got told about a parameter they never touched — and
one that is ignored entirely when adaptive=False:

Preprocessor(numerical_method="ple", output_dim=0)
-> min_output_dim must be >= 1, got 0.
   Fix: raise min_output_dim to at least the family minimum.

Acting on that "Fix:" line would not have helped.

The two halves of the package also disagreed: families that pre-validate output_dim
themselves reported it correctly, while those relying on the shared resolver did not.

ple          output_dim=0 -> min_output_dim must be >= 1, got 0.
cubicspline  output_dim=0 -> output_dim must be >= 3 for the cubic spline basis, got 0

Fix

Pick the name from the branch that produced the value — min_output_dim only when
adaptive is set and the caller supplied one, otherwise output_dim. The "Fix:" line
follows suit.

ple                        output_dim=0     -> output_dim must be >= 1, got 0.
cubicspline                output_dim=0     -> output_dim must be >= 3 ...
adaptive, min_output_dim=0                  -> min_output_dim must be >= 1, got 0.

Tests

Three added to tests/test_exceptions.py: the non-adaptive message names output_dim, it
does not mention min_output_dim, and the adaptive path still names min_output_dim when
that is genuinely what was set.

Cosmetic, but it is the first thing a user sees when they mis-size a transformer, and it was
pointing at the wrong knob.

Full suite: 483 passed, 9 xfailed. ruff check clean on changed files; pyright unchanged at
its pre-existing 71 errors.

🤖 Generated with Claude Code

@ChrisW09
ChrisW09 force-pushed the fix/floor-error-names-output-dim branch 2 times, most recently from 714dd2b to 40b265f Compare July 27, 2026 20:48
``_resolve_output_bounds`` reported every floor violation against
``min_output_dim``, but ``lo`` is set to ``output_dim`` on the non-adaptive
branch. So setting ``output_dim=0`` blamed a parameter the caller had not
touched -- and one that is ignored entirely when ``adaptive`` is False:

    Preprocessor(numerical_method="ple", output_dim=0)
    -> min_output_dim must be >= 1, got 0.
       Fix: raise min_output_dim to at least the family minimum.

Following that advice would not have helped. Families that pre-validate
``output_dim`` themselves (cubicspline, bspline) already reported it correctly,
so the two halves of the package disagreed.

Name the parameter that produced the value.

    ple          output_dim=0 -> output_dim must be >= 1, got 0.
    cubicspline  output_dim=0 -> output_dim must be >= 3 for the cubic spline basis, got 0
    adaptive, min_output_dim=0 -> min_output_dim must be >= 1, got 0.

Closes #38

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ChrisW09
ChrisW09 force-pushed the fix/floor-error-names-output-dim branch from 40b265f to 825a053 Compare July 27, 2026 20:49
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.

fix(core): report output_dim, not min_output_dim, when it is too small

1 participant