-
Notifications
You must be signed in to change notification settings - Fork 31
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
Improving the API, how to implement constraints and extended likelihood #24
Comments
In my opinion, the most logical way to do it would be this: # unconstrained model for the data
x = var("x")
mu = par("mu")
sigma = par("sigma")
model = Normal(x, mu, sigma)
# constraint to mu from other experiment:
mu_meas = var("mu_con")
sigma_meas = var("sigma_con")
constraint = Normal(mu_meas, mu, sigma_meas)
# Take
const_model = Join(Join(model), constraint) Alternatively, the two different uses of I don't like the idea of implementing special mechanisms for the Extended Likelihood, as it can be interpreted as a regular MLE model. model = Mix2E(N1, model1, N2, model2) This would probably have to return a scalar likelihood with the poisson constraint applied. |
Oh, and when |
Another idea: It should be possible to auto-join the model. with Model() as model:
# unconstrained model for the data
x = var("x", observed=True)
mu = var("mu")
sigma = var("sigma")
dist1 = Normal(x, mu, sigma)
# constraint to mu from other experiment:
mu_meas = var("mu_con", observed=True)
sigma_meas = var("sigma_con", observed=True)
constraint = Normal(mu_meas, mu, sigma_meas) (No explicit combination of This is very similar to what's done in pymc. |
I also thought, that one should maybe separate Model and Distribution. I do not know how one would make this work, but it looks good to me. |
+1 on using an operator like Mix2E. I like the use of Join() in both cases. I agree that it should be possible to auto-join the model (passing a vector into the argument of a scalar PDF could trigger it, and But I don't like magic. And I think a bit of verbosity on the user side helps catching mistakes and makes error messages more helpful to novices. |
Constraints
These are nothing special i suppose, we just need an operator to join likelihoods with different data sizes.
I think the logical approach for the end user for a constraint would be something like this:
And then fit as usual
Extended Likelihood
It should be as simple as this from the user point of view:
Maybe we can implement the Extended likelihood over a parameter attribute? LIke
N1 = par("N1", num_events=True)
would trigger an extended Likelihood?The text was updated successfully, but these errors were encountered: