Implement ML algorithms from scratch. From gradients to transformers — learn the math, write the code, climb the leaderboard.
The gateway to neural networks. Implement σ(x) in NumPy, understand saturation, and verify with real test cases.
Solve it now →import numpy as np def sigmoid(x): """ σ(x) = 1 / (1 + e^(-x)) Maps any real number → (0, 1) """ x = np.array(x, dtype=float) return 1 / (1 + np.exp(-x)) # Test cases print(sigmoid(0)) # → 0.5 print(sigmoid(1)) # → 0.7310... print(sigmoid(-1)) # → 0.2689...