Lite / Engineering Complex Systems / Week 9
Validating a model and stating its limits
Your cooling model fits the first 30 minutes beautifully. Does it predict the next 30? The only honest way to find out is to keep some data back.
Why should I care?
A model that is only checked on the data it was fitted to has not been tested at all. Validation, with honest limits, is what separates a model someone can rely on from a curve that happens to pass through some dots. It is also the core of your term project.
- Distinguish verification (solving the equations right) from validation (solving the right equations).
- Fit on part of the data, test on the held-out part and quantify the error with RMS and percentage error.
- List a model's assumptions and predict the direction of each one's effect.
Predict
A model fitted to the first half of a data set has RMS error 0.4 °C on that half. On the held-out second half its error will most likely be…
- exactly 0.4 °C
- similar or somewhat larger
- always much smaller
Guess first, then reveal
Fitting tunes the model to the data it sees, including some of its noise, so error on new data is usually similar or larger. A much larger held-out error signals a wrong assumption; a similar one is evidence the model generalises.
Discover
Choose the mug of tea and switch on 'Hold out the second half'. Press Best fit (it now uses the first half only). Compare the RMS errors on the fitting and held-out data. Then deliberately set k 20% too high: which error grows more, and why?
What the interactive shows (text version)
With the hold-out option, the decay-fit lab fits k on the first eight cooling readings (filled dots) and tests it on the last eight (hollow dots). The readout gives the RMS error on both parts; with the best-fit k both are well under 1 °C. Setting k 20% too high makes the held-out error grow much more than the fitting error, because errors in k accumulate over time.
Understand
Verification and validation
Verification: does the code solve the equation correctly? Check against an exact solution and by halving the step (week 8). Validation: does the equation describe the real system? Check against data the model was not tuned on. A perfectly verified model of the wrong physics is still wrong.
Hold-out testing
Split the data before fitting: fit on one part, then predict the other. Report the error on the held-out part, with units: RMS = √(mean of squared residuals), or percentage error |model − data|/data. For time series, hold out the later part: that is what a prediction actually has to do.
Assumptions and their effects
Cooling model: well-mixed liquid (one temperature), constant room temperature, constant k (in fact convection and radiation make k vary with temperature), no evaporation (which speeds early cooling). Drag model: linear drag (often quadratic in air), still air. For each, say which way it pushes the prediction and when it matters.
Explain it another way
Intuitive
Practising only the exam questions you have already seen tells you nothing about the real exam. Holding out data is keeping some questions back to test yourself honestly.
Technical
Report fit RMS, held-out RMS, and the residual pattern on the held-out set. A systematic held-out residual (all positive, growing) indicates a missing mechanism rather than noise.
Mathematical
RMS = √(Σrᵢ²/n). With one fitted parameter and n points, the fit RMS slightly underestimates the noise; dividing by n − 1 instead of n corrects for that.
Applied
Safety-critical models (aircraft loads, battery thermal runaway) are validated against tests that were planned before the model was tuned, and their reports list the conditions under which the model has not been validated.
Worked example 1
Held-out residuals are 1, −1, 2 and −2 °C. What is the RMS error?
Squares: 1, 1, 4, 4; mean 2.5; RMS = √2.5 = 1.58 °C.
Common mix-ups
A low error on the fitting data validates a model.
✓ Only error on data not used for fitting tests whether the model generalises.Listing limitations weakens a report.
✓ Stating limits honestly is what makes the remaining claims trustworthy.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
Apply it
Take your fitted k from the previous lesson. Predict the temperature 10 minutes beyond your last reading, then (if you collected data safely) measure it. Report the error and the one assumption most likely to explain it.
Reflect
What is the difference between verifying and validating a model, and which one did you find harder?
Write your answer on paper or in your own notes. Lite never stores what you write.