Skip to content

fix(architectures): build NDTF on a one-dimensional input - #532

Merged
mkumar73 merged 1 commit into
mainfrom
fix/ndtf-single-feature
Nov 2, 2026
Merged

mkumar73 merged 1 commit into
mainfrom
fix/ndtf-single-feature

Conversation

@ChrisW09

Copy link
Copy Markdown
Collaborator

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 with numerical_method="standardization" or a single integer-encoded categorical feature, that is an empty range. NumPy then raises ValueError: low >= high while the model is built.

Fix

deeptab/architectures/ndtf.py: with input_dim == 1 there 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 on main and 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)

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
mkumar73 merged commit 6140bd8 into main Nov 2, 2026
35 checks passed
@mkumar73
mkumar73 deleted the fix/ndtf-single-feature branch November 2, 2026 08:36
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.

[BUG] NDTF cannot be built on a one-dimensional input (ValueError: low >= high)

2 participants