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?