Spaces:
Sleeping
Sleeping
File size: 407 Bytes
4c97910 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import numpy as np
def sigmoid(x: float) -> float:
return 1.0 / (1.0 + np.exp(-x))
def sigmoid_prime(x: float) -> float:
return sigmoid(x) / (1.0 - sigmoid())
def relu(x: float) -> float:
"""
returns the input if > 0
"""
return max(0.0, x)
def relu_prime(x: float) -> float:
"""
returns 1 if input is +
returns 0 if input is -
"""
return 1 if x > 0 else 0
|