MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / softmax

Function softmax

mla/neuralnet/activations.py:13–16  ·  view source on GitHub ↗
(z)

Source from the content-addressed store, hash-verified

11
12
13def softmax(z):
14 # Avoid numerical overflow by removing max
15 e = np.exp(z - np.amax(z, axis=1, keepdims=True))
16 return e / np.sum(e, axis=1, keepdims=True)
17
18
19def linear(z):

Callers 1

_predictMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected