How to deal with a variable size of the 'observed' variable

Functions decorated with as_op can’t take keyword arguments. You could wrap it in a simple python function:

@theano...
def proc_test(alpha, sigma, Y):
    ...

with model:
    alpha = ...
    sigma = ...

    def logp(Y):
        return proc_test(alpha, sigma, Y)

    Y_obs = pm.DensityDist('Y_obs', logp, observed=Y)
1 Like