MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / sigmoid

Function sigmoid

neural_network/activation_functions/swish.py:21–30  ·  view source on GitHub ↗

Mathematical function sigmoid takes a vector x of K real numbers as input and returns 1/ (1 + e^-x). https://en.wikipedia.org/wiki/Sigmoid_function >>> sigmoid(np.array([-1.0, 1.0, 2.0])) array([0.26894142, 0.73105858, 0.88079708])

(vector: np.ndarray)

Source from the content-addressed store, hash-verified

19
20
21def sigmoid(vector: np.ndarray) -> np.ndarray:
22 """
23 Mathematical function sigmoid takes a vector x of K real numbers as input and
24 returns 1/ (1 + e^-x).
25 https://en.wikipedia.org/wiki/Sigmoid_function
26
27 >>> sigmoid(np.array([-1.0, 1.0, 2.0]))
28 array([0.26894142, 0.73105858, 0.88079708])
29 """
30 return 1 / (1 + np.exp(-vector))
31
32
33def sigmoid_linear_unit(vector: np.ndarray) -> np.ndarray:

Callers 2

sigmoid_linear_unitFunction · 0.70
swishFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected