惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
D
DataBreaches.Net
D
Docker
云风的 BLOG
云风的 BLOG
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
罗磊的独立博客
Martin Fowler
Martin Fowler
U
Unit 42
Engineering at Meta
Engineering at Meta
IT之家
IT之家
Vercel News
Vercel News
B
Blog RSS Feed
人人都是产品经理
人人都是产品经理
博客园 - Franky
博客园 - 【当耐特】
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
MongoDB | Blog
MongoDB | Blog

Lex Blog

冯 · 诺依曼小传 - Lex Blog 高维非凸优化的「鞍点主导」 - Lex Blog 研究关系的三种视角 - Lex Blog 祛魅科研,每个研究生的必修课 - Lex Blog 写作语言的转变 - Lex Blog Representation Manifolds of LLM - Lex Blog The Diagonal Argument: A Proof Technique That Transformed Mathematics and Computer Science - Lex Blog Before Building AGI, We Need to Define It - Sigmoid The Messianic Narrative of Anthropic - Lex Blog Is Emergence a Mirage? - Lex Blog Proof of the UAT, by Weierstrass Theory - Sigmoid About the Tensor - Lex Blog 暗淡蓝点 - Sigmoid ACCESS BLOCK Dimension Curse on Zero and Positive Curvature Space - Lex Blog Introduction of vMF Distribution on Hypersphere - Lex Blog Nonlinearity with Activations - Lex Blog The Stirling Formula - Lex Blog The Lamentable Programmers - Lex Blog ACCESS BLOCK
Explanation of Neural Network From Maximum Likelihood Est...
Ethan Zhang · 2026-06-08 · via Lex Blog

2026, June, 08

Explanation of Neural Network From Maximum Likelihood Estimation

From a statistical learning perspective, modern neural networks can indeed be understood as a large-scale maximum likelihood estimation (MLE) process. Specifically, a neural network is a parameterized function, and the most common way to train a neural network is to perform maximum likelihood estimation on the data.

MLE (Maximum Likelihood Estimation) is one of the core ideas in statistics.

One-sentence summary:

MLE selects, from all possible model parameters, the one that "makes the observed data most likely."

Below, you find a damaged coin with uneven texture. So you don't know if it is fair. That is, when you toss this coin, you don't know the probability of heads or tails. You want to know: what is the probability pp of getting heads.

Thus, you decide to toss it 10 times consecutively and obtain the following result: heads 8 times, tails 2 times.

Suppose this were a fair coin. Then we set the prior hypothesis p=0.5p=0.5.

Under this prior hypothesis, the probability of obtaining the above result is:

P(D∣p=0.5)=0.510≈0.000976P(D|p=0.5) = 0.5^{10} \approx 0.000976

That is, if this were a fair coin, then the probability of getting 8 heads and 2 tails in 10 tosses is about 0.0009760.000976clearly, this number is considered impossible in probability and statistics. So you can clearly feel that this coin is not fair.

Now we propose another hypothesis: suppose the probability of heads is p=0.8p=0.8. Then the probability of the above result is:

P(D∣p=0.8)=0.88×0.22≈0.0067P(D|p=0.8) = 0.8^8 \times 0.2^2 \approx 0.0067

We also find that when p=0.8p=0.8, the probability of the above result is maximized, achieving the maximum value 0.00670.0067.

0.0067>0.0009760.0067 > 0.000976

This shows that if the probability of heads is 0.8, then the likelihood of observing this data is greatest.

Thus: p^=0.8\hat p=0.8

This is maximum likelihood estimation.

Given data:

D={x1,x2,⋯ ,xn}D = \{x_1, x_2, \cdots, x_n\}

Suppose we have model parameters: θ\theta.

The likelihood function is defined as:

L(θ)=P(D∣θ)L(\theta) = P(D|\theta)

Maximum Likelihood Estimation (MLE) is:

θ^=arg⁡max⁡θP(D∣θ)=arg⁡max⁡θL(θ)\hat\theta = \arg\max_\theta P(D|\theta) = \arg\max_\theta L(\theta)

Many people feel confused when first learning this:
Since P(D∣θ)P(D|\theta) and L(θ)L(\theta) have exactly the same expression, why change the name?

The key lies in different perspectives:

  • Probability P(D∣θ)P(D|\theta) perspective:
    The parameter θ\theta is a fixed known value, while the data DD is random.
    We ask: "Given the parameter, how likely are different data outcomes?"
  • Likelihood L(θ)L(\theta) perspective:
    The data DD is a fixed observed value, while the parameter θ\theta is a varying unknown quantity.
    We ask: "Under different parameter values, how likely is this observed data?"

According to the conditional formula:

P(D∣θ)=∏xi∈DP(xi∣θ)P(D|\theta) = \prod_{x_i \in D} P(x_i|\theta)

If the data DD contains many samples, multiplying many small numbers yields a result approaching zero, which can cause numerical underflow in computers.

Thus we take the logarithm, converting multiplication into addition:

ℓ(θ∣D)=log⁡P(D∣θ)=∑xi∈Dlog⁡P(xi∣θ)\ell(\theta|D)= \log P(D|\theta) = \sum_{x_i \in D} \log P(x_i|\theta)

After taking the logarithm, the values stay within an acceptable range, making optimization easier.

Therefore, almost all practical training optimizes:

max⁡θℓ(θ∣D)\max_\theta \ell(\theta|D)

This form is called Log-Likelihood.

In the likelihood function, we need to find the parameter θ^MLE\hat{\theta}_\text{MLE} that maximizes the likelihood.

If ℓ(θ∣D)\ell(\theta|D) is differentiable, θ^MLE\hat{\theta}_{\rm MLE} typically satisfies:

∂ℓ(θ∣D)∂θ=0\frac{\partial \ell(\theta|D)}{\partial \theta} = 0

And the second-order condition ensures a maximum:

∂2ℓ(θ∣D)∂θ2<0\frac{\partial^2 \ell(\theta|D)}{\partial \theta^2} < 0

Take the simplest Bernoulli distribution as an example:

  • Data xi∈{0,1}x_i \in \{0,1\}
  • Model: P(X=1)=p,P(X=0)=1−pP(X=1)=p, P(X=0)=1-p

We have the likelihood function:

L(p∣D)=∏i=1npxi(1−p)1−xiL(p|D) = \prod_{i=1}^n p^{x_i} (1-p)^{1-x_i}

Convert to log-likelihood:

ℓ(p∣D)=∑i=1nxilog⁡p+(1−xi)log⁡(1−p)\ell(p|D) = \sum_{i=1}^n x_i \log p + (1-x_i) \log (1-p)

Take the derivative with respect to pp and set to 0:

∂ℓ∂p=∑xip−n−∑xi1−p=0\frac{\partial \ell}{\partial p} = \frac{\sum x_i}{p} - \frac{n-\sum x_i}{1-p} = 0

Solve to obtain:

p^MLE=∑i=1nxin\hat{p}_{\rm MLE} = \frac{\sum_{i=1}^n x_i}{n}

In neural networks, the MLE parameter θ\theta corresponds to the network's weights and biases, typically denoted as:

θ=W1,b1,W2,b2,…,WL,bL\theta = {W_1, b_1, W_2, b_2, \dots, W_L, b_L}

where LL is the number of layers, WiW_i is the weight matrix of the ii-th layer, and bib_i is the bias vector.

In other words: a neural network is a function family fθ(x)f_\theta(x)

It defines the conditional probability distribution:

Pθ(y∣x)P_\theta(y|x)

Training a neural network = selecting parameters θ\theta that maximize the probability of the observed data:

θ^MLE=arg⁡max⁡θ∏iPθ(yi∣xi)\hat{\theta}_{\rm MLE} = \arg\max_\theta \prod_i P_\theta(y_i | x_i)

Take classification as an example: a binary classification neural network outputs:

y^=σ(fθ(x))\hat{y} = \sigma(f_\theta(x))

We see that maximizing the likelihood can be written as minimizing the cross-entropy loss function as the cost function:

θ^MLE=arg⁡max⁡θ∏iy^iyi(1−y^i)1−yi\hat{\theta}_{\rm MLE} = \arg\max_\theta \prod_i \hat{y}_i^{y_i} (1-\hat{y}_i)^{1-y_i}

Finally, we obtain the cross-entropy loss:

L(θ)=−∑i[yilog⁡y^i+(1−yi)log⁡(1−y^i)]L(\theta) = - \sum_i \Big[ y_i \log \hat{y}_i + (1-y_i) \log (1-\hat{y}_i) \Big]

Here θ\theta represents all weights and biases.

Take regression as another example: suppose

yi=fθ(xi)+ϵi,ϵi∼N(0,σ2)y_i = f_\theta(x_i) + \epsilon_i, \quad \epsilon_i \sim N(0, \sigma^2)

Log-likelihood:

ℓ(θ)=−12σ2∑i(yi−fθ(xi))2+C\ell(\theta) = -\frac{1}{2\sigma^2} \sum_i (y_i - f_\theta(x_i))^2 + C

We see that the maximum likelihood objective is equivalent to minimizing the mean squared error, where θ\theta = the weights and biases of the neural network.

The hidden assumption here is that the errors follow a Gaussian distribution. If we instead assume a Laplace distribution, MLE would lead to the MAE loss. This explains why different tasks choose different loss functions — they correspond to different assumptions about the data distribution.

In neural networks, maximum likelihood estimation means finding, among all possible combinations of weights and biases, the set that makes the training data most likely to occur.

Therefore, every time we use gradient descent to update weights, we are essentially performing MLE optimization.