Forming multivariables with concatenation

I have an array of homogenous random variables (say uniform),
pm.Uniform('vars', .0, 1., shape=5)
Now, I’d like to fix one of the variables in this array to a specific value, for example, the last element is always 1.
How can I achieve that? I tried concatenation but this doesn’t seem to work.
va = pm.Uniform(‘vars’, .0, 1., shape=4)
vf = tt.concatenate(va, tt.constant(1.))
TypeError: ("The 'tensors' argument must be either a tuple or a list, make sure you did not forget () or [] around arguments of concatenate.", vars)

Maybe the question generalizes to: can we possibly form arrays of heterogenous rv’s via concatenation?

Maybe theano.tensor.inc_subtensor helps in your case?
We recently had it in this thread. I’ve never tried it with a constant, though!

Cheers,

Falk

1 Like

I tried:
p0 = pm.Uniform(‘p0’, 0., 1., shape=S-1)
p1 = pm.Uniform(‘p1’, 1., 1., shape=1)
phi = tt.inc_subtensor(p0, p1)

TypeError: x must be the result of a subtensor operation

scratch this. It actually works for fixing certain values !
Thanks