The goal of this issue is to implement a more robust fix for the issue exposed through PR #28.
Many samplers in this package can accept a set of explicit initial parameter values (constructor parameter init). Currently, there's no check that the supplied prior for the model parameters actually has the right size/shape, leading to possible undefined behavior.
Most likely the fix is going to be something like modifying the constructors of the affected samplers to throw an error if init.shape != model.dims(), but there's a few issues to discuss:
Do we have a clear design decision that model dimensions are always linear?
In the event that the init parameter has the right overall length but a different shape from _theta, do we want to reshape or throw?
Can/should we generalize this check to avoid code repetition among the different affected models, either through a Protocol with a partial implementation, or through a shared utility function, etc? We've talked about inheritance vis-a-vis samplers, but haven't really implemented anything like it yet.
I expect the overall code changes to be minimal (unless we get really ambitious with project structure), but I'd like to have a record of the discussion in case we need to refer back to it.
The goal of this issue is to implement a more robust fix for the issue exposed through PR #28.
Many samplers in this package can accept a set of explicit initial parameter values (constructor parameter
init
). Currently, there's no check that the supplied prior for the model parameters actually has the right size/shape, leading to possible undefined behavior.Most likely the fix is going to be something like modifying the constructors of the affected samplers to throw an error if
init.shape != model.dims()
, but there's a few issues to discuss:init
parameter has the right overall length but a different shape from_theta
, do we want toreshape
or throw?Protocol
with a partial implementation, or through a shared utility function, etc? We've talked about inheritance vis-a-vis samplers, but haven't really implemented anything like it yet.I expect the overall code changes to be minimal (unless we get really ambitious with project structure), but I'd like to have a record of the discussion in case we need to refer back to it.