# Weight gradients show how to adjust connections print("Weight gradient calculation:") print("dW2 = a1.T @ dz2 / m") print(f"a1.T shape: {a1.T.shape}") # Transposed hidden activations print(f"dz2 shape: {dz2.shape}") # Output gradients print(f"dW2 shape: {(a1.T @ dz2).shape}") # Weight gradients # This gives us the gradient for each weight connection print(f"\nWeight gradients tell us:") print(f"- Positive gradient: decrease this weight") print(f"- Negative gradient: increase this weight") print(f"- Large gradient: this weight has big impact on error")