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
data with all vectors
d= np.array([[1,2,1],[2,1,3],[4,5,4],[2,2,1]])
mean of the data in vector form, which will have same length as input vector(here its 3)
mean = sum(d,axis=0)/len(d)
OR
mean=np.average(d , axis=0)
mean.shape
finding covarianve of vectors which will have shape of [input vector shape X input vector shape] here it is 3x3
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
preparing a multivariate Gaussian distribution from mean and co variance
dist = multivariate_normal(mean,cov)
finding probability distribution function.
print(dist.pdf([1,2,3]))
3.050863384798471e-05
The above value gives the likelihood.