Check model coords for unknown shapes when building predictive models #413
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.
Closes #412
When a user defines a time-varying parameter, he has to give it shape None when building the symbolic graph. This is because the time dimension, unlike all other dimensions, has to remain flexible.
A consequence of this is that the
.type.shape
information will have aNone
. This was assumed to always be known by thePyMCStateSpace
model class, and was used when makingpm.Flat
RVs in predictive models (sample_conditional
,sample_unconditional
,impulse_response_function
, andforecast
). PyMC evidently doesn't let you passNone
as a shape to an RV.Since
PyMCStateSpace
stores the coords used to fit the model, we can just check those as a fallback to get the expected shapes of RVs. This PR does that. Tasks that require changing the shape of the time dimension will still fail (e.g.forecast
), but that is always going to be true with exogenous time-varying parameters.