Hi Team, apologies if this question was already asked but all the related discussions I have found made use of Theano tensors and I am not sure that this is still the recommended approach.
Question is how can I construct ad-hoc Deterministic variable where the calculation uses functions not directly available in pymc.math.
In my case I am just trying to evaluate a Deterministic bincount variable:
import pymc as pm
import numpy as np
def bincount(input):
return np.bincount(input.eval())
with pm.Model() as model:
p = pm.Uniform('p', lower=0, upper=1)
samples = pm.Bernoulli('samples_0', p=p, size=100)
sum_value = pm.Deterministic('sum_value', pm.math.sum(samples))
bin_count_value = pm.Deterministic('bin_count_value', bincount(samples))
→ sum_value works well, but bin_count_value breaks with error message:
var = var.copy(model.name_for(name))
ValueError: order must be one of ‘C’, ‘F’, ‘A’, or ‘K’ (got ‘bin_count_value’)
Thank you