MCPcopy Create free account
hub / github.com/PythonOT/POT / df

Function df

test/test_da.py:986–994  ·  view source on GitHub ↗
(G)

Source from the content-addressed store, hash-verified

984 return res
985
986 def df(G):
987 W = nx.zeros(G.shape, type_as=G)
988 for i in range(G.shape[1]):
989 for lab in lstlab:
990 temp = G[labels_a == lab, i]
991 n = nx.norm(temp)
992 if n:
993 W[labels_a == lab, i] = temp / n
994 return W
995
996 # new vectorized implementation for the cost estimator
997 labels_u, labels_idx = nx.unique(labels_a, return_inverse=True)

Callers 1

Calls 2

zerosMethod · 0.45
normMethod · 0.45

Tested by

no test coverage detected