Open jessegrabowski opened 3 months ago
@jessegrabowski Assign me this issue, I can help with this.
You can definitely take it, but I want to wait for input from other devs before doing anything.
I much prefer the new suggested names. I use those terms all the time myself
Description
The
Transform
class is one of the most confusing parts of PyMC, and issues using them are frequent on the discourse. See here and here for recent examples.When I go in to help people with these issues, I am tasked with explaining what is going on, which involves reasoning about what transformers do. Consider this code from
init_point.py
:The transform goes "forward" (from where?), applies jitter, then goes "backward" (to where?). In my opinion, the names of these methods do not help the reader understand the role of the
Transform
. While this certainly isn't what makesTransformer
s confusing to the end user, it certainly doesn't help.My proposal would be to rename
forward
tounconstrain
andbackward
toconstrain
. These names aren't perfect, I have at least two objections:to_unconstrained
andto_constrained
would be more correct, but they are uglier imo.Despite these flaws, reading the code with these names I can at least understand that the incoming samples are expected to be constrained (thus the application of the
unconstrain
method). The jittering is happening in the unconstrained space (that makes sense) then the samples are sent back to the constrained space at the end.Again, none of this will make users understand that forward sampling doesn't use the transforms, or that initial points need to be manually specified under transformations! But I still think it's a justified change.
Under this proposal, the
forward
andbackward
methods can stay as aliases toconstrain
andunconstrain
with aDeprecationWarning