Hey – I’ve got a similar situation but I’d like to actually create a new random variable that I can use as a proposal distribution for Metropolis. Here’s my current (not working) attempt…
class SomeDistribution(pm.Categorical):
def __init__(self, levels, *args, **kwargs):
super(SomeDistribution, self).__init__(*args, **kwargs)
self.levels = theano.shared(levels)
def random(self, *args, **kwargs):
f = super(SomeDistribution, self).random(*args, **kwargs)
return self.levels[f]