Day 3:深入神经网络——现代深度学习的引擎
Day 3: Inside Neural Networks — The Engine of Modern Deep Learning
神经网络用感知机(人工神经元)替代生物细胞,通过权重、偏置和激活函数处理图像、音频、文本等非结构化数据。网络由输入层、隐藏层和输出层构成,隐藏层堆叠即深度学习的由来。训练依靠前向传播预测、损失函数衡量误差、反向传播配合梯度下降更新权重,并自动学习特征,免去人工特征设计。
Classical machine learning algorithms are very good at structured data, like the rows and columns of a spreadsheet. But images, audio and raw text are different: there is no neat column that says "this part of the photo is an ear". To handle that kind of unstructured data, we use Artificial Neural Networks (ANNs).
The Biological Inspiration
An artificial neural network is an information-processing model loosely inspired by the nervous system. In the human brain, billions of simple cells interact and work in parallel, and that teamwork produces complex abilities like recognizing a face. A neural network borrows that idea. It uses simple mathematical units called perceptrons, or artificial neurons, in place of biological cells.
In plain terms: Picture a small committee. Each member (an input) gets a vote, but some members are trusted more than others (the weights). The committee adds up the votes, adds a personal lean (the bias), and then decides whether it is confident enough to speak up (the activation function).
Diagram: One artificial neuron: each input is multiplied by its weight, the results are added with a bias, and an activation function decides what comes out. See the animated version.
The Anatomy of the Network
A standard neural network arranges these neurons into three kinds of layers:
- Input layer: receives the real-world data, such as the pixels of an image, and passes it into the network.
- Hidden layers: sit in between and learn the complicated relationships in the data. When a network links many of these layers together, it is called deep learning.
- Output layer: delivers the final prediction or classification, such as "Cat, 92%".
Diagram: The three kinds of layers: the input layer takes in the data, hidden layers find patterns, and the output layer gives the answer. Many hidden layers make a network deep. See the animated version.
The Mechanics of Learning
A network does not know how to solve a problem when it is created. It learns by adjusting its own internal numbers, through repetition.
- Weights and biases: as data moves from one neuron to the next, a weight scales it, and a bias is added so the model can fit the data more accurately. These are the numbers the network adjusts as it learns.
- Activation functions: a gatekeeper that looks at the total a neuron receives and decides what it passes on. Without them, a network could only learn simple straight-line patterns.
Diagram: An activation function acts as a gatekeeper. With ReLU, a neuron stays silent for negative input and passes positive input straight through. See the animated version.
- Forward propagation: information flows one way, from the input, through the hidden layers, to the output, to produce a prediction.
- The loss function: once there is a prediction, the loss function measures how far it is from the true answer. A big loss means a big mistake.
- Backpropagation: to shrink that error, the network works backward through its layers. Using the chain rule from calculus, it works out how much each neuron contributed to the mistake and updates the weights so the next attempt is better.
Diagram: Learning has two passes: the signal flows forward to make a prediction, then the error flows backward so each weight can be adjusted. See the animated version.
Put together, this is the loop that every neural network goes through during training:
Diagram: The training loop: predict, measure the error, find who is responsible, adjust, and repeat thousands of times. See the animated version.
As the loop repeats, the loss keeps falling:
Diagram: Loss is the size of the network's mistakes. Training pushes it down round after round, quickly at first and then more slowly. See the animated version.
In plain terms: Imagine walking down a foggy hill, trying to reach the lowest point. You cannot see the valley, so you feel the slope under your feet and take a small step downhill, again and again. Training does the same with the weights. This method is called gradient descent.
Diagram: Gradient descent: picture the error as a hill. Each update moves the weights one small step downhill until the error is as low as it can get. See the animated version.
Why Deep Learning Changes the Game
Historically, people had to decide by hand which features of the data a model should look at, like edges in an image or word counts in a document. That manual feature design was slow and expensive, and it limited how well the model could do. Deep neural networks remove that bottleneck. They learn the features on their own, layering them inside the network: first simple patterns, then parts, then whole objects, until they can give a clear answer.
Diagram: Deep learning builds understanding in steps: simple edges first, then shapes and parts, then whole objects. The network works this out itself. See the animated version.
Diagram: The big change: classical machine learning needs people to design the features by hand, while a deep network learns them from the raw data. See the animated version.
Coming Up Next
Day 4: The AI project lifecycle, from raw data to production deployment.
ArtificialIntelligence #DeepLearning #NeuralNetworks #MachineLearning #AILearning #TechEducation #DataScience #Innovation
Originally published at https://sureshpallapothu.in/blog/day-3-inside-neural-networks, where this post includes animated diagrams.
来源:Google AI:DEV 作者专属(RSS) · dev.to