diff --git a/test/demo.py b/test/demo.py index 058ae42..6e2f3a7 100644 --- a/test/demo.py +++ b/test/demo.py @@ -12,16 +12,19 @@ yr_ = np.sqrt(np.var(m[1,:])) mn = np.array([list( (m[0,:]-xu_)/xr_),list( (m[1,:]-yu_)/yr_)]) cx = np.cov(mn) n = m.shape[0] -x = np.array([2.5,3.1]) +x = np.array([2.4,3.1]) u = np.array([xu_,yu_]) d = np.matrix(x - u) d.shape = (n,1) a = (2*(np.pi)**(n/2))*np.linalg.det(cx)**0.5 -b = np.exp(-0.5*np.transpose(d) * (cx**-1)*d) +b = np.exp((-0.5*np.transpose(d)) * (np.linalg.inv(cx)*d)) from scipy.stats import multivariate_normal xo= multivariate_normal.pdf(x,u,cx) yo= (b/a)[0,0] -for row in np.transpose(m): - print ",".join([str(value) for value in row]) +e= 0.001 +print [yo,yo < e] +print [xo,xo < e] +#for row in np.transpose(m): +# print ",".join([str(value) for value in row]) #-- We are ready to perform anomaly detection ...