Repository navigation
Conversation
_validate_target_array only checked poisson/negativebinom for non-negative and gamma/inversegamma/lognormal for positive targets. Fractional counts, negative zip targets and beta targets outside (0, 1) crashed mid-training with raw torch support errors after the previous model was discarded, and negative tweedie targets trained silently. Count families now require non-negative integers, tweedie non-negative values and beta values strictly between 0 and 1, all rejected with a DataError before any estimator state changes. Fixes #487
ChrisW09
force-pushed
the
fix/lss-target-support
branch
from
October 21, 2026 23:01
619ba6c to
c791935
Compare
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.
Fixes #487
Problem
LSS
fit()validated target support only forpoisson/negativebinom(non-negative) andgamma/inversegamma/lognormal(strictly positive). For the other families:ziptargets andbetatargets outside (0, 1). The previously fitted estimator was discarded on the way.tweedietargets trained silently.Fix
_validate_target_array(deeptab/models/base.py) now also checks the count families,tweedieandbeta:poisson,negativebinom,ziptweediegamma,inversegamma,lognormalbetaViolations raise
DataError(family='…' requires … target values) during input validation, before any estimator state changes. This is the same path the positive-support families already used, so a failed call keeps the previous fitted model.y_valgoes through the same check. Targets that were valid before are still accepted. The only behaviour change is that inputs which used to crash mid-training or train on invalid targets are now rejected up front.Tests
tests/core/test_exceptions.py:tweedierejects negatives and accepts zeros;betarejects 0, 1 and values outside the interval, and accepts values inside it.tests/integration/test_estimator_input_validation.py:MLPLSS.fitraisesDataErrorfor each new case without building a data module or model.19 of the 26 new cases fail on
main; the 7 that pass are acceptance cases (valid targets that must keep working). All pass with this change.dirichlet, whose targets must be positive proportions summing to one per row, is not checked here; it still fails during training on invalid targets.Docs
docs/core_concepts/training_and_evaluation.mdreplaces the sentence that covered only the positive-support families with a table of the valid targets per family.Checks
just test: 3262 passed, 46 skipped, 28 xfailed; coverage 91.29%just docs: build succeeded (warnings treated as errors)just check: all hooks passed (ruff, prettier, pyright)