# Let's understand sigmoid step by step: 1 / (1 + e^(-x)) x = 2.0 print(f"Input: x = {x}") print(f"Step 1: -x = {-x}") print(f"Step 2: e^(-x) = np.exp(-x) = {np.exp(-x):.3f}") print(f"Step 3: 1 + e^(-x) = {1 + np.exp(-x):.3f}") print(f"Step 4: 1 / (1 + e^(-x)) = {1 / (1 + np.exp(-x)):.3f}") print(f"Sigmoid result: {sigmoid(x):.3f}") # Why clipping? print(f"\nWhy we clip large values:") large_x = 1000 print(f"Without clipping: np.exp(-{large_x}) would cause overflow") print(f"With clipping: np.exp(-500) = {np.exp(-500):.2e} (very small, safe)")