PLAIN/TEXT — ISSUE 183/456 COMPUTER SCIENCE · FOUNDATION / AI LEARNING · ~4 MIN READING DATE: 2027-04-02 ARCHIVE: https://plaintext.click/newsletter/ SUBJECT: How does a prediction line decide where to sit? How does a prediction line decide where to sit? =============================================== / START HERE A delivery shop records journey distance and delivery time. Linear regression is a method that fits a straight-line prediction rule to paired measurements. Real journeys do not all land on one line, so the method needs a precise way to compare the prediction with what actually happened. / WHY NOW A prediction line is a compromise across examples, not a line obliged to pass through every dot. The way its errors are counted determines which compromise training prefers. / THE IDEA Let distance be the input and minutes be the output. The rule has a starting value plus an added number of minutes for each kilometre. Training adjusts those two numbers. A residual is the observed answer minus the predicted answer; it preserves whether the prediction was too high or too low. One common fitting rule squares each residual and adds the squares. Squaring prevents a positive error cancelling a negative one, and it makes a large miss count disproportionately. Least squares means choosing the line with the smallest such total, among the candidate lines allowed by the model. / THE FORMAL IDEA ŷ = a + bx; residual = y − ŷ - ŷ, read y-hat, is predicted minutes; y is observed minutes. x is distance in kilometres. - a is predicted minutes at zero distance; b is minutes added per kilometre. A squared residual has units of minutes squared. / RUN THE TINY EXAMPLE Change one thing. Predict what happens. Toy records: 1 km took 4 min; 2 km took 6 min. Try ŷ = 1 + 2x: predictions 3 and 5; residuals 1 and 1. Squared-error total = 1² + 1² = 2. Change a from 1 to 2: predictions 4 and 6; total becomes 0. Changing only the starting value moves both predictions together. Here that fixes both misses because the toy records happen to lie on the same straight line. With many noisy records, moving the line to improve one prediction may worsen another; the total provides a consistent comparison. / SO WHAT? Residuals are also useful after fitting. If long trips are repeatedly underestimated while short trips are overestimated, their pattern suggests the rule is missing structure. A single average error can hide that pattern because opposite signs cancel. Inspecting the mistakes tells you something different from inspecting the final fitted coefficients. / ONE CAVEAT A straight line may be inappropriate, and unusual records can strongly influence squared-error fitting. A zero training error on two invented journeys does not establish reliable predictions for unfamiliar distances or future traffic. / KEEP THIS A fitted line balances errors according to its scoring rule, so changing how errors are counted can change the learned prediction. / SOURCE TRAIL [1] Google — Linear regression loss https://developers.google.com/machine-learning/crash-course/linear-regression/loss NEXT: What makes twice the voltage mean twice the flow? --- HARD IDEAS. PLAIN TEXT. You are receiving this because you asked for one clear computer-science or physics idea each day. Unsubscribe: https://plaintext.click/unsubscribe View in browser: https://plaintext.click/newsletter/2027/04/2027-04-02-linear-fit-residuals.html From: Plain/Text / Brickston Consulting · 30 N Gould St Ste N, Sheridan, WY 82801 US · knowledge@plaintext.click