Repository navigation
fix(architectures): build NDTF on a one-dimensional input - #532
Merged
Merged
Conversation
Every NDTF tree after the first samples an input prefix with np.random.randint(1, input_dim), an empty range for input_dim == 1, so NDTF failed with "low >= high" for a single feature with a one-dimensional preprocessing (e.g. standardization). Use the single input dimension for every tree in that case. Fixes #531
mkumar73
approved these changes
Nov 2, 2026
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.
Fixes #531
Problem
NDTF gives the first tree the full input and every other tree a random input prefix, drawn with
np.random.randint(1, input_dim). For a one-dimensional input, such as a single feature withnumerical_method="standardization"or a single integer-encoded categorical feature, that is an empty range. NumPy then raisesValueError: low >= highwhile the model is built.Fix
deeptab/architectures/ndtf.py: withinput_dim == 1there is no smaller prefix to sample, so every tree uses the single input dimension. Inputs with more than one dimension sample exactly as before.Tests
tests/architectures/test_ndtf.py::test_one_dimensional_input_builds_every_tree_on_that_input: all trees get input dimension 1, and the forward pass has the expected shape. It fails onmainand passes with this change.Docs
No change needed.
Checks
just test: 3237 passed, 46 skipped, 28 xfailed; coverage 91.29%just docs: build succeeded (warnings treated as errors)just check: all hooks passed (ruff, prettier, pyright)