The assemble_coefficient_vector
seems to have an error. Where you wrote:
coefficients = pm.StudentT(f'β_{feature}', nu=4, mu=0, sd=sigma, shape=(N, 1))
coefficient_vector.append(coefficients)
coefficient_vector = theano.tensor.concatenate(coefficient_vector, axis=0)
The coefficients
random variable is a 2D array of shape (N, 1)
. Then when you concatenate
, you are doing so on axis=0
, which means that the output’s shape will be (M*N, 1)
. You should change those lines to:
coefficients = pm.StudentT(f'β_{feature}', nu=4, mu=0, sd=sigma, shape=(N,))
coefficient_vector.append(coefficients)
coefficient_vector = theano.tensor.stack(coefficient_vector)
Checkout stack
's documentation and you’ll see that this will output an (M, N)
shaped tensor.