Skip to content

Define the prediction error of a prediction; name the deviation from the conditional mean - #292

Merged
d-morrison merged 15 commits into
mainfrom
claude/prediction-function-relink
Oct 31, 2026
Merged

d-morrison merged 15 commits into
mainfrom
claude/prediction-function-relink

Conversation

@d-morrison

@d-morrison d-morrison commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Ezra · project thread

Important

Stacked on #291. Merge that first; this PR then retargets to main.

Follow-up to #291, which defines "prediction function":

  • def-prediction-error now defines the error of a prediction ŷ of an outcome Y as ŷ − Y, with only that equation (Ezra, 2026-10-29: define it in terms of the predicted value; psw#419: a definition holds only the defining equation). Before, it was stated for a prediction function and carried commentary about the estimand. The example and a remark (the prediction function's prediction f(X), and the reference value being the outcome, not the conditional mean) each move to their own subfile.
  • in lem-prediction-error-split, writes the gap f(X) − μ(X) with the shared \devof macro and names it the deviation of the prediction function from the conditional mean, the convention already in the macros notation-choices page ("Noise, deviation and error");
  • relinks the two remaining "prediction function" mentions (rem-reducible-risk, rem-irreducible-risk).

No new macro: \prederrf{\predfn} still prints the prediction error of the prediction f(X).
Not rendered locally: expectation.qmd stops on a missing R package in an unrelated chunk.


🤖 Generated with Claude Code

https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL

Finish the prediction-function relink in the two remarks that follow the
definition. In the prediction-error split, write the gap with the shared
deviation macro and name it as the deviation of the prediction function from
the conditional mean, the convention in the macros notation-choices page.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL
…tion

The prediction error is the prediction minus the outcome, so define it for a
prediction (a constant or g(X)) with only that equation. Move the example and
the note about the prediction function and the reference value to their own
subfiles.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL
@d-morrison d-morrison changed the title Name the prediction function's deviation from the conditional mean Define the prediction error of a prediction; name the deviation from the conditional mean Oct 29, 2026
…wn subfile

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9nVFCSNv3sBfesyDpL
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor Author

Agent reply to the review of 94a5b89: its findings do not apply to this PR's diff.

The last commit, 94a5b89, only merges claude/prediction-function, which had merged main. The cross-entropy, KL-divergence and entropy subfiles the review names (_def-kl-divergence, _thm-cross-entropy-*, _thm-entropy-continuous, _def-cross-entropy) arrived through main. Against its base, this PR still changes the same 8 files as at dff766e: the prediction-error definition, remark and example, lem-prediction-error-split, the two risk remarks, cor-best-predictor-unique and expectation.qmd. None of them is in the review's findings.

I am leaving those files alone here. Their owner can fix them in a PR on main, and this branch picks the fixes up the next time it merges main.


Generated by Claude Code

@dem-extra1

Copy link
Copy Markdown
Contributor

🤖 Antigravity agent report

Cross-harness review (Gemini 3.8 Flash (Medium) via Antigravity agy 1.3.5, standing in while Argon quota is exhausted, read-only plan mode) at 94a5b89

This PR is stacked on pds#291 (base claude/prediction-function).
I gave the model the full diff (8 files, 7.9 KB) and facts I checked: \devof, \est, \prederrf, \predfn and \truemeanf exist in the pinned macros (\devof{a}{b} prints the parenthesised difference (a - b)); variance-covariance.qmd and its def-deviation exist; the example's numbers are right (f1(0) = 3, mu(0) = 1, Y = 0, so 3 = 1 + 2); and rem-prediction-error is included after def-prediction-error and before def-squared-error-risk, so the notation is explained before it is used.
I checked each finding below against the files; nothing was rendered, and the build job was still pending.

The mathematics is correct: err(f) = f(X) - Y = (mu(X) - Y) + (f(X) - mu(X)), and the definition now holds only the defining equation, with the notation err(f) for the error of the prediction f(X) explained in the remark.

Findings

  1. The lemma's statement has no subject.
    "the prediction error is the prediction error of $\truemean$ plus the [deviation] ..." drops "of $\predfn$" that the old text carried in "the prediction error splits as: $\prederrf{\predfn} = \dots$".
    Write "the prediction error of $\predfn$ is the prediction error of $\truemean$ plus ...".
  2. f(X) is still called the prediction function (the same issue as in pds#291).
    "For any prediction function $\predfnf{\Predvar}$" names the value, while rem-prediction-error and the new definition distinguish the function f from the prediction f(X).
  3. The proof cites the definition for a notation the remark introduces.
    The first step says "(definition of $\prederrf{\predfn}$)", but def-prediction-error now defines the error of a prediction y_hat, and the notation for a function is in rem-prediction-error; cite @rem-prediction-error (the same applies to $\prederrf{\truemean}$, which the remark covers because mu is a prediction function).

I disagree with several of the model's points.
It says that the linked def-deviation defines only a deviation from a mean, but that definition reads "the difference between a value and a reference value" for any quantity, and the mean-specific version is a separate definition (def-deviation-pop-mean), so the link is right.
It says the example should link "prediction function" instead of "prediction" for f1(X) = 3, but f1(X) = 3 is a prediction (a value), so the link is right.
It says err(f1) and err(mu) are random variables equated to constants, but the example fixes X = 0 and Y = 0 in its first sentence.
It says the definition needs to say which observation Y belongs to, but the definition is for any prediction of any outcome, and rem-prediction-error supplies the new observation.

Verdict

VERDICT: FINDINGS

Reviewed-Commit: 94a5b89

Posted by Claude Code (AI agent) --- not written by a human.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@dem-extra1

Copy link
Copy Markdown
Contributor

🤖 Antigravity agent report

Cross-harness review (Gemini 3.8 Flash (Medium) via Antigravity agy 1.3.5, standing in while Argon quota is exhausted, read-only plan mode) at e09dc84

This supersedes my read of 94a5b89.
This PR is stacked on pds#291; I gave the model the current full diff (8 KB) and the facts I had checked, and I checked the findings below against the files at this head.
Nothing was rendered.

Fixed: the lemma's statement now has its subject ("the prediction error of $\predfn$ is the prediction error of $\truemean$ plus ..."), says "prediction function $\predfn$", and the proof starts with "The notation $\prederrf{\predfn}$ is introduced in @rem-prediction-error" and labels its steps "(prediction error notation)".
The merge resolution is right: def-prediction-error keeps its equation-only definition of the error of a prediction.
The mathematics is correct (err(f) = err(mu) + (f(X) - mu(X))).

Findings

  1. cor-best-predictor-unique still calls f(X) the prediction function.
    This PR touches the file only to change the link target, so "Every prediction function $\predfnf{\Predvar}$ with $\E{\predfnf{\Predvar}^2} &lt; \infty$" keeps the value where pds#291 now writes $\predfn$ for the other statements.
    Write "$\predfn$ with $\E{\predfnf{\Predvar}^2} &lt; \infty$" there too.
  2. The lemma links forward to a later chapter.
    expectation.qmd is listed before variance-covariance.qmd in the site index, and the lemma sends the reader to variance-covariance.qmd#def-deviation for "deviation".
    The definition itself is general ("the difference between a value and a reference value"), so either move or duplicate that general definition into an earlier page, or leave "deviation" unlinked here and link it from the later page.
  3. The example calls f1 a "constant prediction" (a nit).
    "the constant prediction $\predfn_1\paren{\Predvar} = 3$ has prediction error $\prederrf{\predfn_1} = 3$" uses the function notation of the remark; "the constant prediction function $\predfn_1$" would match the example in pds#291.
  4. "which is" before a displayed equation in rem-prediction-error (a nit).
    "meaning $\prederrf{\predfnf{\Predvar}}$, which is" is followed by a full equation ε(f) = f(X) - Y; end the sentence with a colon after "meaning" or write the equation as "so" a clause.

I disagree with the model's last point (that the proof's introduction should speak of the notation in general, because it also covers $\prederrf{\truemean}$): mu is a prediction function, so the sentence already covers it.

Verdict

VERDICT: FINDINGS

Reviewed-Commit: e09dc84

Posted by Claude Code (AI agent) --- not written by a human.

…d tidy the remark

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FWgYrE7LQ7q9Lw5qkHaNiT
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FWgYrE7LQ7q9Lw5qkHaNiT
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@dem-extra1

Copy link
Copy Markdown
Contributor

🤖 Antigravity agent report

Cross-harness review (delta-focused, Gemini 3.8 Flash (Medium) via Antigravity agy 1.3.5, standing in while Argon quota is exhausted, read-only plan mode) at 096dcf8

This supersedes my read of e09dc84 and covers the compare e09dc84...096dcf8 (six files), with my earlier items in the prompt.
This PR is stacked on pds#291, and the delta includes the same changes as that PR's latest round.
Fixed: cor-best-predictor-unique now says "Every prediction function $\predfn$ with ..."; rem-prediction-error now reads "meaning $\prederrf{\predfnf{\Predvar}}$. It is" before the equation; and both best-predictor examples call f1 a constant prediction function.
Nothing was rendered.

Findings

  1. The forward reference in the lemma is labelled, not removed.
    The lemma now reads "plus the difference $\devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$ between the [prediction] of $\predfn$ and the [conditional mean] (the deviation of the former from the latter, defined in a later chapter)".
    The page order in the site index still puts variance-covariance.qmd after expectation.qmd, and "defined in a later chapter" is the kind of forward signpost the lab's writing rule asks to remove.
    Drop the parenthesis (the displayed equation already says what the difference is) and link "deviation" from the later page, or define the general deviation earlier.
  2. "conditional mean" is linked again in the lemma (a nit).
    The lemma's first sentence links "conditional expectation function" to #def-cond-expectation-function, and the new parenthetical links "[conditional mean]" to the same target; the second link can be plain text.
  3. The reducible-risk example still mixes "prediction function" and "prediction" (the same as in pds#291).
    f1 is "the constant [prediction function]" and f2 is "the prediction $\predfn_2\paren{\Predvar} = 4\Predvar$" in one sentence.
  4. The exm-prediction-error-split example still says "constant [prediction] $\predfn_1\paren{\Predvar} = 3$" (a nit).
    I raised this one before, and it is unchanged; write "constant [prediction function] $\predfn_1$" if you want it to match the other examples.

Verdict

VERDICT: FINDINGS

Reviewed-Commit: 096dcf8

Posted by Claude Code (AI agent) --- not written by a human.

@github-actions

Copy link
Copy Markdown
Contributor

Claude finished review — View run


I fetched PR #292 live. It is open, not a draft, not merged, and its head is still 121785f45b4bb6cbe9c0e751ad92a60bf9b9188a, the commit I reviewed.

Review of PR #292 at 121785f

This round covers 096dcf8..121785f: 3f59df2, 121785f and the merge f3e6bf2. I read the range diff. The merge matches git's automatic merge of its parents. I did not render the site.

_subfiles/_exm-reducible-risk.qmd:6

  • f2 is now described as "the prediction function $\predfn_2$, with $\predfn_2\paren{\Predvar} = 4\Predvar$". This matches how the same example already describes f1.
  • It uses the existing \predfn macro, with no literal letters.

_subfiles/_exm-prediction-error-split.qmd:6

  • f1 is now "the constant prediction function $\predfn_1$, with $\predfn_1\paren{\Predvar} = 3$".
  • The anchor #def-prediction-function exists at _subfiles/_def-prediction-function.qmd:1.
  • expectation.qmd:106 includes that definition before the example, so there is no forward reference.

_subfiles/_lem-prediction-error-split.qmd:4-7

  • The lemma now reads "between the prediction $\predfnf{\Predvar}$ and $\truemeanf{\Predvar}$". That is one link per term.
  • It drops the forward link to variance-covariance.qmd#def-deviation and the parenthetical about a later chapter. This removes the forward reference, and the displayed equation still uses \devof unchanged.
  • The line holds a single clause, so it does not break the clause-level line-break rule.
  • The math uses \predfnf, \truemeanf and \devof, all existing macros.

I found nothing new in this range.

The blocking items in my round at 94a5b89 were in the entropy and cross-entropy subfiles: the KL definition, the continuous cross-entropy hypothesis, and the line breaks. This range does not touch those files, so I could not confirm whether they were fixed. My round at e09dc84 found nothing new in the prediction-function files and did not re-check those items either. The author should confirm they were addressed in the commits between e09dc84 and 096dcf8.

Verdict

Ready for merge, for the changes in this range only.

Structured Review Data (JSON)
{
  "schema_version": "1.1",
  "reviewer": "claude",
  "commit_sha": "121785f45b4bb6cbe9c0e751ad92a60bf9b9188a",
  "verdict": "CLEAN",
  "findings": [],
  "detailed_assessment": "The three edited subfiles use existing macros and resolvable anchors, and the lemma no longer forward-links to the deviation definition in a later chapter.",
  "holistic_assessment": "The range is a small consistency edit of prediction-function wording and introduces no regression; entropy and cross-entropy findings from an earlier round were outside this range and not re-verified."
}

This is an automated non-interactive review run whose output a harness posts. I made no changes to the checkout.

Stopping Point: Clean stopping point reached --- session done; UMS executed; no follow-up items pending

Reviewed commit: 121785f

@github-actions

Copy link
Copy Markdown
Contributor

💰 Cost: $0.2591 (review) — run

@dem-extra1

Copy link
Copy Markdown
Contributor

🤖 Antigravity agent report

Cross-harness review (delta-focused, Gemini 3.8 Flash (Medium) via Antigravity agy 1.3.5, standing in while Argon quota is exhausted, read-only plan mode) at 121785f

This supersedes my read of 096dcf8 and covers the compare 096dcf8...121785f (three files, three small hunks), with my four findings in the prompt.
This PR is stacked on pds#291.
Fixed: the lemma now reads "plus the difference $\devof{\predfnf{\Predvar}}{\truemeanf{\Predvar}}$ between the [prediction] $\predfnf{\Predvar}$ and $\truemeanf{\Predvar}$", so the link to the later variance chapter and the phrase "defined in a later chapter" are gone, and the second link to the conditional mean is gone; _exm-reducible-risk.qmd calls f2 a prediction function like f1; and _exm-prediction-error-split.qmd now says "the constant [prediction function] $\predfn_1$, with $\predfn_1\paren{\Predvar} = 3$".
The model reported that each edit is correct, that the forward reference and the duplicate link are removed, that the terminology is consistent and that nothing else changed; it found nothing.
I read the hunks and agree.
Nothing was rendered.

Verdict

VERDICT: CLEAN

Reviewed-Commit: 121785f

Posted by Claude Code (AI agent) --- not written by a human.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.

2026-10-31 04:20 UTC

Base automatically changed from claude/prediction-function to main October 31, 2026 04:19
@d-morrison
d-morrison merged commit 422ca25 into main Oct 31, 2026
30 checks passed
@d-morrison
d-morrison deleted the claude/prediction-function-relink branch October 31, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants