0

I'm trying to build a multivariate normal distribution from my multiclass problem. Lets suppose we have c*N*x data where c is number of classes (>2), N is samples number for class c and x is number of features.

What I'm trying to get is the probability of a random x-lenght sample of built multivariate normal distribution in TF2.

What I've done so far is this:

mean_vec = []
std_vec = []

for c in classes:
    mean_vec.append(mean([N*x] of c)) # <- mean return a scalar
    std_vec.append(std([N*x] of c))  # <- std return a scalar

distr = tfp.distributions.MultivariateNormalDiag(loc=mean_vec, scale_diag=std_vec)

y = (random x-lenght sample)

distr.prob(y)

But if I build the distribution like this it accept only 1-lenght float value, if I try to feed .prob with y it gives an error.

I would like get the probability of y is in distribution.

What I'm missing about multivariate normal distributions?

TheEnigmist
  • 906
  • 1
  • 10
  • 23
  • What is the shape o `y` and `distr.event_shape`? – jcaliz Oct 07 '21 at 19:32
  • y has the same shape of x. for distr it print that the shape is [c] (number of classes). I think I need to create a multivariate with event_shape the same of x – TheEnigmist Oct 07 '21 at 20:32

0 Answers0