I’m trying to build a model with a constrained likelihood. Simplifying it a bit, it looks like this:
B ~ N (0, I) Y_Pred_train = X_train @ B Y_Pred_test = X_test @ B if (Y_pred_test > Y_test).all(): likelihood ~ N(Y_pred_train, I, observed = Y_train) else: likelihood = neg_infinite
Basically: I only want samples where (Y_pred_test > Y_test) - and for those a regular Gaussian likelihood is fine. I can code this up in emcee easily enough, but, is there an idiomatic way to implement this in Pyro and sample it through nuts?