HeadlinesBriefing favicon HeadlinesBriefing.com

Visualizing Multi-Input Neural Networks with Python

DEV Community •
×

A tutorial moves beyond single-input models to demonstrate neural networks with two inputs—Petal Width and Sepal Width—and one output node for the Setosa iris species. The example uses scaled inputs (0 to 1) and specific weights (-2.5, -0.6) with a bias of 1.6 to calculate a hidden node's activation, showing the math behind a simple perceptron.

The walkthrough visualizes the network's behavior in 3D, plotting the activation output against the input axes. Starting from the origin, it generates a series of 'blue dots' along the Petal Width axis while holding Sepal Width constant. This reveals how a single neuron's output changes linearly before an activation function applies a non-linear ReLU cutoff.

Extending the grid to cover the full input space creates a 'bent surface' graph. This visualization clarifies how multi-input neurons partition the feature space, a foundational concept for deeper architectures. The article concludes by pointing to a Colab notebook for hands-on experimentation, setting the stage for expanding the network with additional nodes and layers.