It looks like the provided code snippet for plotting decision boundaries was cut off at the end. Let's complete it and then summarize how to visualize the decision boundary plots for both Sigmoid and ReLU networks.
Completing the Decision Boundary Plot Function
The function plot_boundary is used to plot the decision boundary of a neural network on a given dataset. Here’s how you can complete this function:
python1from matplotlib.colors import ListedColormap 2 3def plot_boundary(ax, net, X, y, title, color): 4 h = 0.025 5 x_min, x_max = X[:, 0].min() - 0.5, X[:, 0].max() + 0.5 6 y_min, y_max = X[:, 1].min() - 0.5, X[:, 1].max() + 0.5 7 8 xx, yy = np.meshgrid(np.arange(x_min, x_max, h), np.arange(y_min, y_max, h)) 9 grid = np.c_[xx.ravel(), yy.ravel()] 10 11 Z = net.forward(grid).reshape(xx.shape) 12 13 # Soft shading 14 cmap_bg = ListedColormap(["# 15 16[Read the full article at MarkTechPost](https://www.marktechpost.com/2026/04/09/sigmoid-vs-relu-activation-functions-the-inference-cost-of-losing-geometric-context/) 17 18--- 19 20**Want to create content about this topic?** [Use Nemati AI tools](https://nemati.ai) to generate articles, social posts, and more.

![[AINews] The Unreasonable Effectiveness of Closing the Loop](/_next/image?url=https%3A%2F%2Fmedia.nemati.ai%2Fmedia%2Fblog%2Fimages%2Farticles%2F600e22851bc7453b.webp&w=3840&q=75)



