MCPcopy
hub / github.com/jindongwang/transferlearning / get_ma_dist

Function get_ma_dist

code/traditional/pyEasyTL/EasyTL.py:25–40  ·  view source on GitHub ↗
(A, B)

Source from the content-addressed store, hash-verified

23 return D
24
25def get_ma_dist(A, B):
26 Y = A.copy()
27 X = B.copy()
28
29 S = np.cov(X.T)
30 try:
31 SI = np.linalg.inv(S)
32 except:
33 print("Singular Matrix: using np.linalg.pinv")
34 SI = np.linalg.pinv(S)
35 mu = np.mean(X, axis=0)
36
37 diff = Y - mu
38 Dct_c = np.diag(diff @ SI @ diff.T)
39
40 return Dct_c
41
42def get_class_center(Xs,Ys,Xt,dist):
43

Callers 1

get_class_centerFunction · 0.85

Calls 1

meanMethod · 0.45

Tested by

no test coverage detected