Validate forecast batch metadata and covariate shapes - #517
ayoubchikri wants to merge 2 commits into
Conversation
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The new context-shape check still accepts a zero-length time axis. np.array([]) passes because it is 1-D, and np.empty((1, 0)) passes because the 2-D guard only checks shape[0]. Both are unusable contexts but continue into trimming/padding/model preprocessing. Please require shape[-1] > 0 for both 1-D and 2-D contexts and cover both empty shapes.
|
Thanks for catching this. Context validation now requires a non-empty time axis for both 1D and 2D inputs. I added regression cases for |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Rechecked b92e02e. Context validation now rejects a zero-length time axis for both 1-D and 2-D inputs, with regressions for np.array([]) and shape (1, 0). This closes the empty-context gap I raised.
predict_batchcurrently accepts inconsistent metadata lengths, malformed context/covariate shapes, and invalid horizons until they fail later in preprocessing or decoding with less useful errors. Validate batch counts, time lengths, context rank, a nonempty context time axis, and a positive integer horizon at the API boundary.The regression tests cover invalid counts and shapes, including empty 1D and 2D contexts, as well as validation before leading-NaN trimming. All 23 targeted tests pass, and Ruff passes for both changed files.