1
2
3
4
5
6
7
8
9 """Simply functors that transform something."""
10
11 __docformat__ = 'restructuredtext'
12
13
14 import numpy as N
15
16
18 """Returns the elementwise absolute of any argument."""
19 return N.absolute(x)
20
21
23 """Returns elementwise '1 - x' of any argument."""
24 return 1 - x
25
26
28 """Return whatever it was called with."""
29 return x
30
31
33 """Mean computed along the first axis."""
34 return N.mean(x, axis=0)
35
36
38 """Sum of absolute values along the 2nd axis
39
40 Use cases:
41 - to combine multiple sensitivities to get sense about
42 what features are most influential
43 """
44 return N.abs(x).sum(axis=1)
45
46
48 """Max of absolute values along the 2nd axis
49 """
50 return N.abs(x).max(axis=1)
51
52
54 """Just what the name suggests."""
55 return N.mean(x)
56