A Neural Network Playground

Joshua Pickard
Geek Culture
Published in
3 min readJan 26, 2022
Neural Network Diagram by 3Blue1Brown

The most popular machine learning algorithm, neural networks aren’t necessarily the best understood or most intuitive models. Decision trees split variables based on rules humans understand and support vector machines try to find a decision boundary between 2 classes, but understanding neural networks isn’t as simple. TensorFlow Playground lets you build, train, and learn about neural networks without being an expert programming or fully understanding what’s happening behind the scenes.

Since neural networks are models that require advanced algebra and calculus, they can be less accessible. For an understanding of the math and an intuitive explanation of neural networks, check out this video by 3Blue1Brown. To learn about neural networks without understanding the algebra and calculus behind the scenes or just to gain a better feel for them if you already know how they work, check out TensorFlow Playground.

TensorFlow Playground

This website lets you build and train neural networks with only the click of a few buttons. You can build, train, test, and visualize the output of your network. Playing with each parameter can give a sense of how it changes the network output.

Screen shot of TensorFlow Playground

This is a fun tool to for building an intuition for what happens as you vary the hyperparameters and architecture of the network.

The website has a few different data sets to train a network. On the right hand side, you see the dataset you selected, and as the network is trained the decision boundary will appear in the plot as well. You can vary how much data is reserved for training and testing in addition to changing the architecture you use.

Architecture and Hyperparameters

A neural network consists of multiple layers of neurons that pass information from the input layer of the network to the output layer. In the center of the screen, you can select the number of layers in your network as well as the number of neurons in each layer.

Every node has activation functions and regularization parameters that can be set. The website has a drop down menu recommending values for each hyperparameter. In addition to the hidden layer architecture, the site lets you select up to 7 different features to be used as input to the network.

Training parameters like batch size and learning rate can be set. It is interesting to see how the training and test loss of the network, which is plotted just about the data on the right, varies with each epoch as the training parameters are varied.

Takeaways

While I understood how the math behind these neural networks before playing on the website, it gave me a better sense of how to train and select network architectures. More complicated models aren’t necessarily better. They take longer to train and are not guaranteed better results.

Below I trained a network to quickly separate the 2 classes. However, I was able to train a network with half as many hidden nodes to make a near identical decision boundary using only 60 epochs, rather than the 250 seen below. This makes me wonder if networks I’ve built in the past have been overly complex.

Trained Neural Network by TensorFlow Playground

Overall, this is a great website and definitely worth checking out!

--

--

Joshua Pickard
Geek Culture

Computer Science and Bioinformatics @ University of Michigan. Website: https://jpickard1.github.io/ Twitter: @JoshuaPickard_