-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make transform a method #174
Conversation
A log message on the default bijector being used would be nice. |
@jobrachem will transfer the core benefits of the |
@jobrachem will continue as follows:
|
29f0749
to
75c7383
Compare
I now harmonized the API between
There is one small difference in how the methods handle it, if the user passes a bijector class: |
@wiep gentle reminder :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work.
I made a few suggestions to make the if statement better comprehensible. I think I would handle the bijector is None case such that I would cast it into a bijector is instance of BijectorType case. Than you need to handle only two cases. See annotations below.
However, both is a bit of a style question. Should you prefer the current version. I'm also ok with that.
Also, please feel free to revert the commit changing doc strings if you do not agree (dfb5217).
Hey @wiep, thanks a lot for your suggestions! I implemented them with only slight deviations. Your change to the docstring is fine with me, too 👍 Your comment about removing the code duplication also alerted me to two issues:
|
This PR introduces a
Var.transform
method. Some notes:Replacing
GraphBuilder.transform
We currently have
GraphBuilder.transform
. The new method is in fact intended as a replacement forGraphBuilder.transform
. HavingVar.transform
as a method onVar
has the advantage that it is easier to find for users. Since the transformation is "doing something to a Var" and it does not actually require any functionality within the GraphBuilder, living as a method on a Var is a natural development for the transform method.Behavior change
The method behaves similar to
GraphBuilder.transform
, with a few notable differences:*bijector_args
or*bijector_kwargs
to be passed to the bijector. This simplifies the code for the default case. More importantly, this fixes the graph representation after transformation, see below.Using a bijector instance:
Compare to using the default event space bijector. Note that in this case, the same bijector is being used, but there are spurious edges from the nodes "v0" and "v1", the prior parameters, to the original variable "tau".
Deprecation and updated documentation
GraphBuilder.transform
as deprecated and included directions towards the new method in its documentation.01a-transform.md
and04-mcycle.md
. As it turned out, usage in these tutorials was outdated anyway.Notebook for testing
You can play around with the method in this notebook:
050-transform.ipynb.zip
Related issues