-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Reinstate log-likelihood transforms #4521
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
Reinstate log-likelihood transforms #4521
Conversation
I take we better wait for this before adding pointwise log likelihood conversion in #4489 ? |
Not necessarily. The interface for log-likelihood computations shouldn't change much/at all. |
I get this error when sampling from a model with Uniforms with pm.Model() as m:
x = pm.Uniform('x', 0, 1)
y = pm.Uniform('y', 0, x, observed=[0.4, 0.5, 0.7])
with m:
trace = pm.sample()
|
36286ea
to
cdd2852
Compare
@ricardoV94, I pushed an update that should fix that issue. More testing is needed, and I need to figure out the best approach to syncing test values, because, right now, changing the test value of a variable does not change the corresponding transformed variable's test value (e.g. changing N.B. I have no intention of literally "syncing" the corresponding In general, we need to remove PyMC3's use of |
cf68232
to
99b1237
Compare
99b1237
to
066330e
Compare
Sounds like we need an entire method to generate / control initial values. Before we were using the mode/ mean/ median when provided by the distribution classes as well as the update_start_vals function to deal with transformations. Should we rethink this approach? Unrelated to this, are we able to get transformed random samples automatically or is the transform only appearing in measure space? |
066330e
to
b0317c6
Compare
We can continue to do that, but in the context of these new initial values, and not by assigning values to
The current implementation automatically creates transformed variables when they're added to the Now that we distinguish between random variables that are actually random variables (i.e. can be sampled) and variables that are used as inputs to log-likelihood graphs but correspond to random variables (i.e. in poor mathematical notation Since |
if transform is not None: | ||
self.deterministics.append(rv_var) | ||
value_var.tag.transform = transform | ||
value_var.name = f"{rv_var.name}_{transform.name}" |
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.
Any reason to drop the dunder at the end of the transformed variable name?
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.
No, no reason. Why was it there in the first place?
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.
Preceeded me. My guess would be to avoid name collisions on the user side.
b0317c6
to
3a82747
Compare
It would be nice to have a helper method to sample transformed variables as well. e.g., SMC starts by sampling from the prior_predictive and converting the samples to untransformed domain to use as the starting point. V4 makes it easier to go from |
I don't know if you intended to deal with this only later, but the current code is only getting samples for the transformed variables during sampling. with pm.Model() as m:
x = pm.Uniform('x', 0, 1)
with m:
trace = pm.sample(compute_convergence_checks=False)
trace.varnames
# ['x_interval'] |
Yeah, I'll do that next. It seems like we'll need a better way to track these transformed variables, though, because the whole Plus, it really won't work well when/if we need to keep track of compiled forward/backward transform graphs. I'm talking specifically about |
While we over-rely on test-values I just want to add that they are nice for debugging a model. |
The previous approach wasn't great either, looking for missing variables and checking if the names corresponded to the transformed / untransformed strings. |
We definitely won't get rid of the ability to use test values; we simply won't rely on them within our codebase. We can even set test values for variables (based on these proposed initial values, of course) by default within the codebase. |
Perfect.
…On Thu, Mar 11, 2021, 19:57 Brandon T. Willard ***@***.***> wrote:
While we over-rely on test-values I just want to add that they are nice
for debugging a model.
We definitely won't get rid of the ability to *use* test values; we
simply won't rely on them within our codebase.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4521 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFETGAHTB25KJY6PUN5653TDEABTANCNFSM4Y4UPFLA>
.
|
ea2b815
to
f101534
Compare
OK, I've added the un-transformed variables to the trace output. |
f101534
to
6c8a2b3
Compare
FYI: There are a lot of important fixes in this PR, so I'm probably going to merge it even if all the tests don't pass yet. |
This PR reinstates the general log-likelihood transform framework.
I'm not happy with the current approach, so I'll probably make quite a few changes.