Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cov_matrix(y1, y2):
- cov1 = np.cov(y1)
- cov2 = np.cov(y2)
- [L1, U1] = np.linalg.eig(cov1)
- [L2, U2] = np.linalg.eig(cov2)
- U1 = U1.real
- U2 = U2.real
- L1 = L1.real
- L1 = L1.real
- L1 = np.diag(L1)
- L2 = np.diag(L2)
- R1 = np.dot(U1, L1)
- R1 = np.dot(R1, U1.T)
- R2 = np.dot(U2, L2)
- R2 = np.dot(R2, U2.T)
- return R1, R2
- def PDF(x, u, R):
- [col] = u.shape
- a = np.power(2*np.pi, col)
- b = np.linalg.det(R)
- den = np.dot(a, b)
- den = np.sqrt(den, 2)
- a = u - x
- b = np.power(R, -1)
- c = np.dot(a.T, b)
- esp = -np.dot(c, a)/2
- F = (exp(esp))/den
- return F
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement