Repository navigation
Conversation
A feature with exactly one observed value (a one-row X, or one non-missing
value among NaNs) has no range, like a constant feature, but slipped past
the constant check, which only ran for two or more observed values.
The B/M/I splines then fitted a knot vector without a positive-width span
and failed inside SciPy at transform ("Need at least two internal knots").
The P-spline and tensor-product bases were all zero, and the cubic and
natural cubic bases silently emitted fewer columns than requested.
Such a feature now raises PretabDataError at fit in every spline family
that needs spread, as a constant feature does. The message keeps the
"1 sample" wording scikit-learn's check_fit2d_1sample expects.
This branch has not been deployed
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.
Problem
A feature with exactly one observed value (a one-row
X, or one non-missing value among NaNs) has no range, like a constant feature, but passedfit: the constant check only ran for two or more observed values.fitsucceeded,transformfailed inside SciPy withValueError: Need at least two internal knots.(also throughPreprocessor(numerical_method="bspline")on a one-row frame).Fix
Such a feature raises
PretabDataErroratfitin every spline family that needs spread, as a constant feature does. The message keeps the "1 sample" wording that scikit-learn'scheck_fit2d_1sampleexpects, so the conformance tier is unchanged.Behaviour change: cubic, natural cubic, P-spline and tensor-product now raise where they silently degenerated before. Two distinct values still fit.
Tests and docs
New cases in
tests/integration/test_edge_case_contract.py; the edge-case section ofchoosing_a_method.mdand the spline docstrings are updated.Validation
Checks: full suite (2572 passed, 59 skipped, 7 xfailed, coverage >= 94.79%),
ruff format/ruff check, pyright (no new diagnostics), docs build with-W,scripts/quickstart.py. Merges cleanly withmainand with #136.