Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Equation (24.5): under a distribution P on a finite domain, the true log-loss risk of θ is D_RE[P‖P_θ] + H(P)

Proved
UnderstandingML.log_loss_risk_decomposition

by naimengye · Sep 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

entropylog-lossrelative-entropy

Equation (24.5). Assuming that the data is distributed according to a distribution PPP (not necessarily of the parametric form we employ), the true risk of a parameter θ\thetaθ becomes

Ex[ℓ(θ,x)]=−∑xP[x]log⁡(Pθ[x])=∑xP[x]log⁡P[x]Pθ[x]⏟DRE[P∥Pθ]+∑xP[x]log⁡1P[x]⏟H(P).\mathbb{E}_x[\ell(\theta, x)] = -\sum_x P[x]\log(P_\theta[x]) = \underbrace{\sum_x P[x]\log\frac{P[x]}{P_\theta[x]}}_{D_{RE}[P\|P_\theta]} + \underbrace{\sum_x P[x]\log\frac{1}{P[x]}}_{H(P)}.Ex​[ℓ(θ,x)]=−x∑​P[x]log(Pθ​[x])=DRE​[P∥Pθ​]x∑​P[x]logPθ​[x]P[x]​​​+H(P)x∑​P[x]logP[x]1​​​.

Formally: on a finite domain, PPP a probability mass function and PθP_\thetaPθ​ positive.

Preamble
import Definitions.Def_UnderstandingML_Generative

open MeasureTheory ProbabilityTheory
open scoped InnerProductSpace
Formal statement
namespace UnderstandingML

/-- **Equation (24.5)** (p. 345). For data distributed according to a distribution `P` over a
finite domain, the true risk of the parameter `θ` under the log-loss is
`E_x[ℓ(θ, x)] = −∑ₓ P[x] log(P_θ[x]) = D_RE[P‖P_θ] + H(P)`. `P_θ` is positive. -/
theorem log_loss_risk_decomposition {Θ X : Type*} [Fintype X] (P : X → ℝ) (hP : IsPMF P)
    (Pθ : Θ → X → ℝ) (θ : Θ) (hpos : ∀ x, 0 < Pθ θ x) :
    ∑ x, P x * logLoss Pθ θ x = relEntropy P (Pθ θ) + entropy P := by sorry

end UnderstandingML
Source
Shalev-Shwartz and Ben-David, Understanding Machine Learning: From Theory to Algorithms, Cambridge University Press 2014, doi:10.1017/CBO9781107298019, §24.1.2 p. 345, Equation (24.5)
Human review
  • Endorsed by Shuze Chen · Sep 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by naimengye · Sep 25, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me