Neural Network
- In Turkish
- Yapay Sinir Ağı
In short
A neural network is a machine learning model made of layers of connected artificial neurons that learn patterns from data by adjusting numeric weights.
What is a neural network?
A neural network is a type of machine learning model loosely inspired by the brain. It is built from many simple units called neurons, arranged in layers: an input layer that receives data, one or more hidden layers in the middle, and an output layer that produces the result. Each connection between neurons has a number called a weight that controls how strongly one neuron influences the next.
Each neuron multiplies its inputs by their weights, adds them up together with a bias value, and passes the total through an activation function, which decides how strongly the neuron fires. During training, the network compares its output with the correct answer, measures the error with a loss function, and uses an algorithm called backpropagation to nudge every weight in the direction that reduces the error. After many rounds over the training data, the weights encode the patterns the network has learned.
A useful analogy is a large team passing notes forward: each person looks at what they receive, trusts some inputs more than others, and passes a summary to the next row, until the last row makes the final call. Neural networks power image recognition, speech recognition, translation, recommendation systems, and large language models.
Despite the name, artificial neural networks are not simulations of the brain; they are mathematical functions built mostly from multiplications and additions. A neural network is also not the same thing as deep learning. Deep learning refers specifically to neural networks with many hidden layers, while a small network with a single hidden layer is still a neural network.
At a glance
Key takeaways
- A neural network is made of layers of connected neurons: input, hidden, and output.
- Each connection has a weight, and learning means adjusting those weights.
- Training uses a loss function and backpropagation to reduce prediction errors.
- Neural networks with many hidden layers are called deep learning models.
Example
import math
def neuron(inputs, weights, bias):
# Weighted sum of the inputs plus a bias
total = sum(x * w for x, w in zip(inputs, weights)) + bias
# Sigmoid activation squashes the result into the range 0 to 1
return 1 / (1 + math.exp(-total))
# Two inputs, e.g. hours studied and hours slept
inputs = [5.0, 7.0]
weights = [0.6, 0.3] # learned during training
bias = -4.0
print(neuron(inputs, weights, bias)) # about 0.75Readers ask
What is the difference between a neural network and machine learning?
Machine learning is the broad field of models that learn from data, and a neural network is one kind of machine learning model. Other machine learning models, such as decision trees and linear regression, don't use neurons or layers at all.
What is backpropagation?
Backpropagation is the algorithm used to train neural networks. It calculates how much each weight contributed to the error in the output, working backward from the last layer to the first, so every weight can be adjusted slightly to reduce the error.
What is a hidden layer?
A hidden layer is any layer of neurons between the input and the output. Hidden layers transform the data step by step into more useful internal representations, and adding more of them makes the network deeper.
See also
- Machine LearningAI & Machine Learning, p. 27Machine learning is a branch of artificial intelligence in which computers learn patterns from data to make predictions instead of following hand-written rules.
- Deep LearningAI & Machine Learning, p. 14Deep learning is a subset of machine learning that uses neural networks with many layers to learn complex patterns from raw data such as images and text.
- TransformerAI & Machine Learning, p. 49A transformer is a neural network architecture that uses attention to weigh how each token in a sequence relates to the others, and it powers most modern LLMs.
- LLMAI & Machine Learning, p. 25An LLM is a machine learning model trained on huge amounts of text that generates language by repeatedly predicting the next most likely piece of text.
- AlgorithmProgramming Fundamentals, p. 2An algorithm is a finite, step-by-step set of instructions for solving a problem or completing a task, such as sorting a list or finding the shortest route.
- BackpropagationAI & Machine Learning, p. 6Backpropagation is the algorithm that trains neural networks by measuring how much each weight added to the error and nudging every weight to reduce it.
Spotted a mistake or something missing on this page?Suggest an edit