Skip to content
MAMasterAI Now

AI 基础阅读约 5 分钟

What Is a Neural Network?

这篇答案尚未翻译成中文,因此你正在阅读英文原文。

简要回答

A neural network is a stack of small mathematical units called neurons. Each neuron multiplies its inputs by learned weights, adds a bias, and passes the total through a non-linear activation function. Stacking those units lets the network learn curved, layered relationships instead of a single straight line — and the weights are adjusted automatically during training rather than written by a programmer.

The idea in plain language

Start with a decision you already understand: should a bank approve a loan? You might score an application by adding up evidence — income counts for something, existing debt counts against it — and compare the total to a threshold. That weighted sum plus a threshold is one artificial neuron.

A neural network takes that idea and layers it. Instead of one score, the first layer computes many scores from the same inputs, and each score becomes an input to the next layer. The final layer produces the answer you asked for: a probability, a price, a class label, or the next token in a sentence.

The word neural is a historical analogy to brain cells, not a claim that a network works like a brain. A neuron here is a number-crunching unit; a network is a directed graph of them.

What one neuron actually computes

A neuron with inputs x₁ … xₙ holds one weight per input (w₁ … wₙ) and one bias (b). It computes a weighted sum, then applies an activation function f:

z = Σᵢ wᵢxᵢ + b a = f(z)
The weighted sum z is the pre-activation; a is what this neuron sends to the next layer.

The weights say how much each input matters and in which direction. The bias shifts the decision threshold, which is why a neuron can fire even when every input is zero. The activation function bends the output: a sigmoid squashes it into 0–1, ReLU keeps positive values and clamps negatives to zero, and tanh maps it into −1 to 1.

PieceWhat it doesLearned or chosen?
Weights (w)Scale each input’s influenceLearned from data
Bias (b)Moves the firing thresholdLearned from data
Activation (f)Adds a non-linear bendChosen by the designer
ArchitectureHow many layers and neuronsChosen by the designer

Why hidden layers and non-linearities matter

A single neuron can only split the world with one straight boundary. That is enough for “approve if income minus debt is above X”, and not enough when the answer depends on combinations of inputs. A hidden layer computes intermediate features — combinations of the raw inputs — and the output layer combines those features into a decision.

Watch outThe mistake almost everyone makes

Stacking linear layers without an activation function does nothing. Two linear layers in a row are still one linear layer, because a matrix multiplied by a matrix is another matrix. Remove the non-linearity and depth collapses.

With a non-linearity between layers the composition becomes genuinely richer. That is the property behind universal approximation results: a network with enough hidden units can approximate a wide class of continuous functions. It is a statement about capacity, not a promise that gradient descent will find those weights, and it says nothing about generalisation to unseen data.

A worked example you can check

Take two inputs, x₁ = 0.8 and x₂ = 0.4, and a hidden layer with two ReLU neurons. Give the first neuron weights w₁ = 1.0, w₂ = −2.0 and bias b = 0. Its pre-activation is 0.8 − 0.8 = 0.0, so ReLU outputs 0.0. If the second neuron has weights 0.5, 0.5 and bias −0.1, it computes 0.4 + 0.2 − 0.1 = 0.5, and ReLU outputs 0.5.

Now suppose the output neuron weights those two hidden values by 2.0 and −1.0, with bias 0.3. The pre-activation is 2.0 × 0.0 − 1.0 × 0.5 + 0.3 = −0.2. A sigmoid turns that into roughly 0.45 — a probability just under one half. Change one hidden weight and the final number moves; that sensitivity is exactly what training exploits.

The demonstration below runs the same forward pass with editable weights, so you can watch one connection change every number downstream.

Where neural networks are used — and where the label misleads

Neural networks are the working core of machine translation, speech recognition, image classification, recommendation ranking and large language models. In every case the pattern is the same: many inputs, several layers of learned features, an output layer shaped to the task, and a loss function that scores how wrong the output was.

The limitation to keep in mind is that a neural network is a function fitted to data. It has no built-in fact database and no automatic check that a confident output is true. A network trained on historical hiring decisions reproduces the patterns in those decisions, including unfair ones — which is why evaluation, data curation and human review sit around the model rather than inside it.

If you want the next layer of detail — how weights are corrected after a wrong answer — read the answer on backpropagation. The number of weights itself is covered in “What are parameters in an AI model?”

How the demonstration maps to the equations

The demo shows two inputs, two hidden neurons and one output. Each arrow carries a weight; each node shows its pre-activation z and its activated value a. Changing the highlighted weight is exactly the wᵢⱼ term in the weighted sum, and the output bar is the sigmoid probability. Nothing is stored and nothing is sent to a server.

Adjust a weight and watch the output move

A two-input, two-hidden-neuron network with a sigmoid output. Change the highlighted connection or an input, and the forward pass recomputes immediately.

Forward pass

h₁ = ReLU(1.00 × 0.80 − 2 × 0.40) = 0.000

h₂ = ReLU(0.50 × 0.80 + 0.5 × 0.40 − 0.1) = 0.500

z = 2.00 × h₁ − h₂ + 0.3 = -0.200

a = sigmoid(z) = 0.4502

Output probability
0.4502
Pre-activation z
-0.200

Raise the output weight and the probability climbs past 0.5. Set the weight into hidden 1 negative and its contribution collapses to zero — that is ReLU switching the neuron off.

Runs entirely in your browser — nothing you change here is sent anywhere.

在课程中深入学习

这些阶段用完整的讲解和实时模拟讲解同一个概念。