Skip to content
AI & MLbeginner

What is a neural network?

Updated Nov 30, 20263 min readBased on official documentation
What is a neural network?

In short

A neural network is a type of machine learning model built from small units called neurons, arranged in layers. Each neuron combines its inputs using weights and passes the result through an activation function. Stacking many neurons lets the network learn complex patterns from data.

A neural network is a model that learns patterns from examples. It is built from many small units called neurons, and the neurons are connected in layers. You do not write the rules yourself. Instead, the network adjusts its internal numbers while it studies data until its outputs become useful.

What a single neuron does

A neuron receives several input values. Each input has a weight, which is a number that says how much that input should count. The neuron multiplies each input by its weight, then adds all the products together. The result is called the weighted sum.

Here is a small example. Suppose a neuron gets two inputs: 1.5 with a weight of 0.5, and 4 with a weight of -0.25. The weighted sum is (1.5)(0.5) + (4)(-0.25), which equals 0.75 - 1 = -0.25.

The neuron does not stop at this number. It passes the weighted sum to an activation function, which decides what the neuron sends onward.

Why activation functions matter

An activation function transforms the weighted sum. Without it, a network made of many neurons would still only combine values in simple, straight-line ways. Activation functions let the network learn curved and more complex relationships between the input features and the answer it is trying to predict.

Two popular choices are ReLU and sigmoid. ReLU keeps positive values and turns negative values into zero. Sigmoid squeezes any number into a range between 0 and 1. Using the sigmoid on the -0.25 from the example gives about 0.44, and that is the value the neuron passes to the next layer.

How the layers fit together

A neural network usually has three kinds of layers. The input layer receives the features of your data, such as the pixels of an image or the numbers in a table row. One or more hidden layers sit in the middle and find intermediate patterns. The output layer produces the final prediction, such as a label or a score.

Each neuron in one layer typically sends its output to every neuron in the next layer. When a network has many hidden layers, people call it a deep neural network, and the field that studies these models is called deep learning.

How a network learns

During training, the network makes predictions on examples where the correct answer is already known. It measures how wrong it was, then slightly changes its weights to reduce that error. It repeats this many times. Large networks need a lot of arithmetic, so specialized hardware such as GPUs and Google's TPUs is often used. These accelerator chips can speed up both training and the later use of the model, called inference.

To check how well a trained network works, you need a metric. Accuracy is the simplest one. It is the number of correct predictions divided by the total number of predictions. Accuracy can be misleading, though. Imagine a city where it snows on only a handful of days per century. A model that always says "no snow" would look very accurate, yet it would never predict a snowy day. For data like this, precision and recall often tell you more.

You can also test whether a part of a network matters. This technique is called ablation. You remove the part, retrain the model, and compare the results. If performance drops a lot, the removed part was likely important.

Common mistakes beginners make

Beginners often start with a network that is far bigger than their data needs. A small dataset can lead to a model that memorizes the examples instead of learning general patterns. Start small, then add layers only if the results call for it.

Another common mistake is trusting one number. Look at several metrics, and check how the model performs on data it did not see during training. Keep a separate test set for this purpose.

Finally, remember that a neural network is a tool, not magic. It needs good data, careful evaluation and a clear goal before it becomes useful.

Where to go next

If you want to explore the vocabulary further, the Google Machine Learning Glossary defines many of the terms used here, including activation function, accuracy and accelerator chip. Read a few entries alongside a small experiment, such as training a tiny network on a simple table of numbers. Seeing the weights change is often the fastest way to understand the idea.

FAQ

Do I need to be a math expert to understand neural networks?

No. The core idea is multiplying inputs by weights, adding them up and passing the result through a simple function. Basic arithmetic is enough to follow the concept, and the rest can be learned with practice.

What is the difference between a neural network and deep learning?

A neural network is the model itself. Deep learning refers to using neural networks with many hidden layers. Every deep learning model is a neural network, but not every neural network is deep.

Why are GPUs or TPUs used for neural networks?

Neural networks perform huge numbers of similar calculations at the same time. Accelerator chips like GPUs and TPUs are designed to run these calculations in parallel, which makes training and inference much faster than on a general-purpose CPU.

Is high accuracy always a sign that a neural network is good?

Not always. If one answer is far more common than the others, a model can score high accuracy by mostly guessing that common answer. Check precision and recall as well.

Sources

This page is based on the official documentation below. Read it for full detail.

Neural network — official documentation ↗
blozhikDeveloper news from across the web, explained. Every story links to its original sources.