Artificial Neural Networks, Explained

Artificial neural networks are an essential element of machine learning and automation. In this post we'll do a deep dive on ANNs to learn how they work. Read on to start learning!
Share on linkedin
Share on twitter
Share on facebook

Artificial neural networks are a type of machine learning algorithm that is modeled after the neural network of the human brain. These algorithms can be ‘trained’ to recognize images, identify spam messages, suggest medical diagnoses, forecast the weather, and so much more. Sometimes called ANNs or neural nets, this type of algorithm has foundations in multivariable calculus, linear algebra, and computer science.

What is an Artificial Neural Network?

Artificial neural networks are made up of layers, which are made up of neurons, sometimes called nodes. Their structure is loosely based on the neural network of the human brain. In our brains, neurons take in inputs and then fire signals to other neurons. We think or feel a certain way depending on the particular pattern of signals that fire. 

Artificial neural networks can be trained to accept many types of inputs (images, audio, text, temperature data, etc.) and produce different outputs depending on the goals of the program. Possible outputs might be a forecast, an identification, a classification, a recommendation, or something different entirely.

You can visualize an artificial neural network as a series of layers that each contains neurons. Neurons in the first layer accept an input and produce an output by either firing or not firing. Whether certain neurons fire or not becomes the input for the next layer. That layer uses the input to produce another output, which becomes the next layer’s input, and so on until the final layer produces the output of the algorithm. 

The key parts of an artificial neural network are the input layer, the layer of neurons that take in the input information and either fire or do not fire; the output layer, the final layer of neurons that produces an outcome in a desirable format for human programmers to read; and the hidden layer or hidden layers, which lie in the middle. The hidden layers are ‘hidden’ because the values of the neurons in these layers are not known. 

Parts of an Artificial Neural Network

Diagram of the layers and neurons in an artificial neural network. Connections between neurons in each layer are green if they are fired and grey if not.


Example of a Neural Network: Identifying Handwritten Digits

To explain this in a more concrete way, let’s go over a classic application of neural networks in data science. 

The MNIST Database is a public database containing 70,000 examples of handwritten numbers from 0 to 9. The database has been used by many data science students to practice developing neural networks, and we will use it as an example as well.


Many different examples of handwritten numbers between 0 and 9, arranged in a grid. 

The MNIST database contains thousands of images of handwritten digits from 0 to 9.

In this example, the input is an image of a handwritten number from 0 to 9. The neural network’s job is to identify which number it is. The network’s guess is the output.

For us humans, it is usually pretty easy to identify handwritten numbers, even though people use a wide range of handwriting styles. This ability is not innate for computers, but they can be trained to find patterns and identify the right numbers using a neural network.

Since the handwriting input is in image form, each neuron in the input layer could represent a single pixel. Every pixel has a gray-scale value, which can be stored in the corresponding neuron.

A zoomed in, pixelated image of a handwritten number 8. A label pointing to dark black pixels says, Neurons corresponding to dark-colored pixels have a high value, while neurons corresponding to white and light gray pixels have a lower value. Those with a value above a certain threshold fire, while those below the threshold do not.

The neurons that fire send signals to the hidden layers, which look for patterns in which neurons fire. They use these patterns to help identify a number: Are there straight lines in the image? Are there curves? Are there intersecting lines?

The output layer in this example has ten neurons, one for each possible outcome, 0 through 9. Data passed from the hidden layers to the output layer assigns a probability to each outcome. The neuron with the strongest signal is given as the algorithm’s best guess at identifying the number from the handwritten image.


An Artificial Neural Network for Identifying Handwritten Digits

Example of an artificial neural network with three layers. The first layer corresponds to pixels in an image of a handwritten number. The third layer corresponds to the digits 0 through 9. The number 8 is highlighted in green.

How Do Artificial Neural Networks ‘Learn’?

Programmers train their artificial neural networks to produce the correct outputs by feeding them data and adjusting parameters called weights. A weight value is assigned to every connection in the network. In an untrained neural network, the weights start off with random values. A programmer can then adjust the weights as needed so that the algorithm’s outputs become more and more accurate. Some neural networks need to be run thousands of times before they are able to produce correct outputs a majority of the time. Simpler neural networks can take only a few hours to train.

Other Applications of Neural Networks

Artificial neural networks are used in all kinds of machine learning applications across industries and in daily life. Below are just a few examples.

Virtual Assistants

Neural networks can be used to help virtual assistants, like Siri and Alexa, take in questions from users as inputs and produce answers, actions, and suggestions as outputs.

Media Streaming Platforms

Streaming platforms, like Spotify, YouTube, and Netflix, can use neural networks to take in user activity as inputs and produce a show or music recommendations as outputs.

Fraud Detection

In finance and banking, neural networks can be used to scan through large amounts of transaction data and identify fraudulent activity that does not fit with normal patterns.


In healthcare, artificial neural networks can be fed inputs like symptoms, vital signs, and even X-ray images. They can then produce outputs like recommended treatments and possible diagnoses.


Similar to the handwriting identification example above, neural networks can be trained to take in voice inputs, identify what is being said and produce a text output. You may recognize this technology if you have ever tried using speech-to-text functions to send messages.

Self-Driving Vehicles

One of the newest and most complex applications of neural networks is in self-driving cars. These vehicles must be trained to take in all kinds of inputs in different formats—traffic lights, noises, street signs, movement, etc. They can be trained to produce appropriate outputs that cause the vehicle to stop, turn, slow down, or reverse.

The outlook for artificial neural networks is extremely promising. Programmers are learning to create more and more complex variants that can accomplish all kinds of useful tasks. Ready to learn more about neural networks and put your skills to use? Check out our Guide to Data Science Bootcamps to find a program that covers this topic. Many even offer hands-on neural network design projects.

For a deeper dive into the handwriting example that we used above, this YouTube video is an excellent resource.

Related Articles