Is there any python package that allows the efficient computation of the PDF (probability density function) of a multivariate normal distribution?
It doesn\'t seem to be
The following code helped me to solve,when given a vector what is the likelihood that vector is in a multivariate normal distribution.
import numpy as np
from scipy.stats import multivariate_normal
d= np.array([[1,2,1],[2,1,3],[4,5,4],[2,2,1]])
mean = sum(d,axis=0)/len(d)
OR
mean=np.average(d , axis=0)
mean.shape
cov = 0
for e in d:
cov += np.dot((e-mean).reshape(len(e), 1), (e-mean).reshape(1, len(e)))
cov /= len(d)
cov.shape
dist = multivariate_normal(mean,cov)
print(dist.pdf([1,2,3]))
3.050863384798471e-05
The above value gives the likelihood.