Skip to content

Commit 625e203

Browse files
committed
adding doctest
1 parent 9dbe9b1 commit 625e203

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

neural_network/backpropagation_weight_decay.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,19 @@ def sigmoid(input_: float) -> float:
113113
"""
114114
Sigmoid activation function
115115
Output layer
116+
>>> sigmoid(0)
117+
0.5
118+
>>> round(sigmoid(1), 6) # Approximation for 6 decimal places
119+
0.731059
116120
"""
117121
return 1 / (1 + np.exp(-input_))
118122

119123

120124
def d_sigmoid(input_: float) -> float:
121125
"""
122126
Sigmoid activation derivate
127+
>>> round(d_sigmoid(0), 6)
128+
0.25
123129
"""
124130
return sigmoid(input_) ** 2 * np.exp(-input_)
125131

0 commit comments

Comments
 (0)