Multiple StudentT Likelihoods depending on Tensor Random Variable Matrix

I have variables called Target and Shape which are 1000 X 3. T is my rotation matrix that has random variables (partially shown). (Shape*T - Target) β†’ Each column has errors that are from 3 different student T distributions. I would like to be able to write my 3 likelihoods as below.

    ......
    # Expected value of outcome
    mu = tt.dot(shape, T)

    # Likelihood (sampling distribution) of observations
    Y_obs_x = pm.StudentT("Y_obs_x",nu=nu_x , mu=mu[:, 0], sigma=sigma_x, observed=target[:, 0])

    Y_obs_y = pm.StudentT("Y_obs_y",nu=nu_y , mu=mu[:, 1], sigma=sigma_y, observed=target[:, 1])

    Y_obs_z = pm.StudentT("Y_obs_z",nu=nu_z , mu=mu[:, 2], sigma=sigma_z, observed=target[:, 2])

However I can’t do this since slicing tensors is not allowed for mu. What can I do?

Slicing a tensor should definitely work here. The following example works fine. Is there anything interesting happening upstream of your StudentT distributions?

import numpy as np
import pymc3 as pm

I = np.eye(3)
with pm.Model():
    x = pm.Normal('x', shape=(2,3))
    u = pm.math.dot(x, I)
    y = pm.Normal('y', mu=u[:,0], shape=(2,))
    trace = pm.sample()
1 Like

Thank you for the response. I did try slicing notation and it did work!!