MCPcopy
hub / github.com/dmlc/dgl / transform

Function transform

examples/pytorch/argo/argo.py:22–45  ·  view source on GitHub ↗
(self, X)

Source from the content-addressed store, hash-verified

20
21
22def transform(self, X):
23 X = np.asarray(X)
24 if self.is_int:
25 if np.any(np.round(X) > self.high):
26 raise ValueError(
27 "All integer values should" "be less than %f" % self.high
28 )
29 if np.any(np.round(X) < self.low):
30 raise ValueError(
31 "All integer values should" "be greater than %f" % self.low
32 )
33 else:
34 if np.any(X > self.high + self._eps):
35 raise ValueError("All values should" "be less than %f" % self.high)
36 if np.any(X < self.low - self._eps):
37 raise ValueError(
38 "All values should" "be greater than %f" % self.low
39 )
40 if (self.high - self.low) == 0.0:
41 return X * 0.0
42 if self.is_int:
43 return (np.round(X).astype(int) - self.low) / (self.high - self.low)
44 else:
45 return (X - self.low) / (self.high - self.low)
46
47
48def inverse_transform(self, X):

Callers 15

__call__Method · 0.85
gcnMethod · 0.85
pprMethod · 0.85
test_module_add_reverseFunction · 0.85
test_module_to_simpleFunction · 0.85
test_module_line_graphFunction · 0.85
test_module_khop_graphFunction · 0.85
test_module_composeFunction · 0.85
test_module_gcnnormFunction · 0.85

Calls 1

astypeMethod · 0.45

Tested by 15

test_module_add_reverseFunction · 0.68
test_module_to_simpleFunction · 0.68
test_module_line_graphFunction · 0.68
test_module_khop_graphFunction · 0.68
test_module_composeFunction · 0.68
test_module_gcnnormFunction · 0.68
test_module_pprFunction · 0.68
test_module_heat_kernelFunction · 0.68
test_module_gdcFunction · 0.68