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.
This provides a simpler parser. This is possible because now we are using the relevant variables from the signature and instantiating distributions at their default values. But this is not just a refactor, this also provides more flexible (and "natural") way of specifying the model. For example, this is a valid syntax
b = pz.Normal(np.exp(a)*x, c).rvs()
, when previously thenp.exp
would have needed to be applied on a separate line.This also tries to be more "clever" and determine the boundary information (the info in parentheses next to the sliders name) of the parameters not only from the information of the parameter itself (e.g. a scale parameter, restricted to be positive), but also of the functions applied to them.
For instance
a = pz.Normal(0, c).rvs()
, c is restricted to be positive here, but it can be negative herea = pz.Normal(0, np.exp(c)).rvs()
. Providing a truly general solution will probably be too hard, and it may require a different approach to parse the function. Something easier may be to solve a few common cases and for those that can not be solved return "(unk, unk)", signaling that the function is not able to guess the boundaries of the parameter. This will be complemented by allowing the users to modify themin
andmax
values of each slider directly using text boxes, and/or passing a dictionary.