Code
d = read.csv("data/tennis.csv")
dim(d)Probabilities, evaluation, and regularization
George Mason University
The line is . In the picture, has length 1, so the perpendicular is . In general, equals that distance times the length of .
[0.119 0.5 0.881]
A negative logit is a probability below one half. A logit of zero is one half.
The bookmaker’s spread, split by whether the favorite won. Turquoise is a win. Purple is a loss. The losses sit on the smaller spreads.
Predicting whether the favorite wins from the point spread. No intercept: a spread of zero is a probability of one half.
Why doesn’t doubling the spread double the probability?
[0.5 0.651 0.777]
| Feature | Coefficient |
|---|---|
| Metro region | 0.28 |
| Gender (male) | 0.31 |
| Graduate education | 1.16 |
| Undergraduate education | 0.22 |
| Company count | 0.14 |
| Function count | 0.26 |
| Industry count | −0.22 |
| Years of experience | 0.09 |
All three have fifteen years.
Start from person B at 15 percent. Each line is one change, holding the rest fixed.
Taken together, the probability goes to about 81 percent. Adding the separate lifts does not give that number. The sigmoid is not linear.
For an outcome and a predicted probability ,
The loss is the negative log of that probability.
Training minimizes the average of these losses.
At , . The loss grows as moves toward the wrong outcome.
The event does not happen. Should they receive the same loss?
5 minutes. Paper or calculator.
The outcome is . The loss is .
Calculate it for and for .
Now the outcome is . The loss is . Which probability is cheaper?
The event did not happen, so and the loss is .
The event did happen, so and the loss is .
Both numbers are above one half, so a yes-or-no score calls both predictions right, or both wrong. The loss does not. It charges the model that was sure and wrong.
The sample likelihood is the product of the Bernoulli probabilities, with .
Maximizing that likelihood is the same as minimizing the sum of the losses.
The binary loss is the cross-entropy between the observed label and the predicted probability.
With more than two labels, the observation is one class. Cross-entropy is then , the negative log probability of the class that occurred.
For observed class , the loss is .
Subtracting the largest score before exponentiating leaves the probabilities unchanged and avoids overflow.
Does adding 1,000 change the answer mathematically?
Two classes used the sigmoid of one logit, and the loss .
Many classes used the softmax of the logits, and the loss . A language model repeats that step.
At threshold 0.5:
Which points would a straight boundary always struggle with?
| Outcome 1 | Outcome 0 | |
|---|---|---|
| Act | True positive | False positive |
| Do not act | False negative | True negative |
At , acting costs and not acting costs .
Why act when the event is less likely than not?
With , , the costs are 3, 6, and 16.
Which threshold wins under equal costs?
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The Prediction Problem:
Notation:
Training Dataset:
Goal: Design rule to predict for new
%%| fig-width: 6.5
%%| fig-align: center
graph LR
x --> f((f))
f --> y
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Key properties:
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Probit model uses normal CDF:
Comparison:
Predicted probabilities:
Binary prediction:
Common choice:
Accuracy: Proportion of correct predictions
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Let’s start by loading and exploring the tennis match data:
Let’s look at a few columns of randomly selected five rows:
Final match statistics are unavailable before the match. Distinguish post-match association from pre-match forecasting. Confirm the data dictionary before interpreting BPW units.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The logistic regression model:
Where:
Final match statistics are unavailable before the match. Distinguish post-match association from pre-match forecasting. Confirm the data dictionary before interpreting BPW units.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Final match statistics are unavailable before the match. Distinguish post-match association from pre-match forecasting. Confirm the data dictionary before interpreting BPW units.
| Predicted: YES | Predicted: NO | |
|---|---|---|
| Actual: YES | TPR (True Pos) | FNR (False Neg) |
| Actual: NO | FPR (False Pos) | TNR (True Neg) |
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
plot(d$BPW.1+rnorm(n),d$BPW.2+rnorm(n), pch=21, col=d$Result+2, cex=0.6, bg="yellow", lwd=0.8,
xlab="BPW by Player 1", ylab="BPW by Player 2")
legend("bottomright", c("P1 won", "P2 won"), col=c(3,2), pch=21, bg="yellow", bty='n')
# Add decision boundary
x = seq(0,30,length.out = 200)
y = -m$coefficients[1]*x/m$coefficients[2]
lines(x,y, lwd=2, col="red") The decision boundary occurs where , meaning log-odds = 0:
Therefore:
Points above the line: Player 2 more likely to win
Points below the line: Player 1 more likely to win
Final match statistics are unavailable before the match. Distinguish post-match association from pre-match forecasting. Confirm the data dictionary before interpreting BPW units.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
What happens when Player 1 wins one additional break point?
Effect: Probability increases from 50% to 60%
Final match statistics are unavailable before the match. Distinguish post-match association from pre-match forecasting. Confirm the data dictionary before interpreting BPW units.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Interpretation: Each additional break point won increases the odds of winning by a factor of 1.5
Mathematical derivation:
Final match statistics are unavailable before the match. Distinguish post-match association from pre-match forecasting. Confirm the data dictionary before interpreting BPW units.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
What about winning 3 more break points than the opponent?
Result: Probability increases by 27 percentage points (from 50% to 77%)
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
“Are women’s matches less predictable than men’s matches?”
This is a common claim in tennis commentary. We can test this using model residuals.
Larger residuals = Less accurate predictions = More unpredictable matches
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Conclusion: The conventional wisdom is statistically supported - women’s tennis matches are indeed less predictable based on break points won.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Let’s create a circular dataset to demonstrate the kernel trick:
The data in the circle-data plot is clearly not linearly separable. However, if we map it to a three-dimensional space using the transformation: and attempt to linearly separate the transformed data, the decision boundaries become hyperplanes in , expressed as . In terms of the original variables , these boundaries take the form: which corresponds to the equation of an ellipse. This demonstrates that we can apply a linear algorithm to transformed data to achieve a non-linear decision boundary with minimal effort.
Now, consider what the algorithm is actually doing. It relies solely on the Gram matrix of the data. Once is computed, the original data can be discarded: Here, , which contains all the data, is referred to as the design matrix.
When we map the data using , the Gram matrix becomes: Let us compute these inner products explicitly. For vectors and in corresponding to and , respectively:
where and are the original 2D vectors, and and are their transformations in .
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Let’s implement and visualize the transformation:
Three main components:
Goal: Find regions that minimize:
Algorithm: Top-down, greedy approach
At each step, find optimal split:
Optimization problem:
Prediction in region :
Decision trees create a flowchart of if-then rules that:
We’ll explore tree-based models using the classic diamonds dataset:
| Variable | Description | Values |
|---|---|---|
carat |
Weight of the diamond | Numeric |
cut |
Quality of the cut | Fair, Good, Very Good, Premium, Ideal |
color |
Color of the diamond | J, I, H, G, F, E, D |
clarity |
Clarity of the diamond | I1, SI2, SI1, VS2, VS1, VVS2, VVS1, IF |
depth |
Depth of the diamond | Numeric |
table |
Width of the diamond’s table | Numeric |
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Although carat is the most important factor, it’s not the only one:
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Let’s start simple with just two predictors:
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Observation: Clarity becomes most important around 1 carat level
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The visualization shows several key patterns:
Note
The Algorithm:
From here we’ll explore:
Key insights:
For Saratoga use the revised 1,728-row fit. Its intercept is extrapolation, not an identified land value. Legacy dataset with a problematic constructed racial variable. Retained for historical critique, not recommended as an unqualified classroom benchmark.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Results: Step function fit with 7 regions, clear visualization of decision boundaries
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Variable importance: Total decrease in node impurity when splitting on each variable, averaged over all trees
State the proposed project’s prediction time, available inputs, target, and action.
Explain who bears a false positive and a false negative.
Name a simple baseline. Identify a result that would make you reconsider the project question.
What does a logit of zero mean?
Why is a probability of 0.99 costly when the event fails to happen?
What changes in the fitted parameters when you change only the threshold?
What happens to the preferred threshold when false negatives become more costly?
Validation, generalization, and leakage.
Choose before seeing new observations. State the evidence you wish you had.
A small loss on the same observations answers a limited question.
We need evidence about observations that did not participate in fitting or selecting the model.
| Data | Job |
|---|---|
| Training | Fit parameters and preprocessing |
| Validation | Choose features, models, and tuning settings |
| Test | Evaluate the fixed choice |
Selecting a model is a use of data, even when no coefficient is fitted directly to those data.
Why would using the validation mean change the experiment?
is the number of observations being evaluated.
RMSE is , in the units of the response.
The metric must reflect the question. A large error counts strongly under squared loss.
The ranking on the training observations need not be the ranking on the validation observations.
Prediction time: before a tennis match starts.
| Proposed input | Available then? |
|---|---|
| Player identities and scheduled surface | Yes |
| Past-match summaries computed before today | Potentially |
| Today’s final break-point statistics | No |
| Today’s final score | No |
Would your answer change for a post-match explanation?
Original tennis example
Good explanation after the event, or a usable prediction before it?
If you fitted the scaler again on the single validation case, what would happen?
What does parallel execution change: elapsed time, total work, or both?
A team tries twenty models and reports the smallest test error.
What did the test set become?
It participated in selection. A fresh evaluation is needed for the selected procedure.
Recall the original betting performance plot.
| Check | Question for this example |
|---|---|
| Prediction time | Were those odds available when the choice was made? |
| Selection | Did the same results choose and evaluate the rule? |
| Baseline | Does the comparison use a comparable opportunity set and stake? |
| Execution | Could the quoted bets actually be placed? |
Which check would you run before trusting the blue curve?
Kaunitz, Zhong, and Kreiner (2017): historical simulations, paper trading, and a smaller real-money experiment.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Build logistic regression model
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Define the ROC curve function
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The Scenario: You’re a quant at a trading firm with a new algorithm that outperformed the state-of-the-art on historical data.
The Question:
Sequential Analysis:
The Problem:
The Test:
The Surprising Result:
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Test Setup:
Result: Pink background significantly outperforms!
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
October 19, 1987: S&P 500 dropped -21.76%
Historical Context: - Prior monthly returns: 1.2% mean, 4.3% volatility - Distribution:
Z-Score Calculation:
Interpretation:
An extremely rare occurrence!
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Conclusion: Since 0.5 is outside the confidence interval, we have evidence that coin tosses were not fair.
2006 Discovery Channel Experiment
Results:
Mythbusters Conclusion: Yawning is contagious!
But is this statistically significant?
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Statistical Conclusion: Large overlap, CI contains 0 - no evidence of difference!
The Experiment:
| Algo1 | Algo2 | |
|---|---|---|
| Success | 1755 | 1818 |
| Failure | 745 | 682 |
| Total | 2500 | 2500 |
Estimated Success Rates:
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Result: Intervals don’t overlap, difference CI doesn’t contain 0 - Algo 2 is significantly better!
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Pepsi’s Claim: “More than half of Diet Coke drinkers prefer Diet Pepsi”
The Test: Double-blind experiment with 100 drinkers
Result: 56 favor Pepsi
Hypothesis Setup:
Conclusion: is in the CI - Pepsi’s claim is not supported!
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Biogen’s Claim: “95% patient satisfaction rate” FDA Investigation: 60% satisfaction in random sample of 75 patients Question: Who is right?
Hypothesis Test: - (Biogen innocent) - (FDA right) - (1% significance level)
Result: Z = -14, p-value ≈ 0 - FDA is right, Biogen is wrong!
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
1998 Data:
Statistical Analysis:
Result: CI doesn’t contain 0 - evidence of higher death rate with Viagra!
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The Experiment:
The Data:
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The Discovery: - Z-score ≈ 20 (20-sigma event!) - Massive statistical significance - Argon was discovered - the “inert” gas in air!
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Approximating a challenging function:
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Observations:
Lesson: High-degree polynomials fit training data perfectly but fail completely on test data
Einstein’s Principle: “A model should be simple, but not simpler”
Solution: Regularization!
Solutions:
Why Explainability Matters:
Modern Techniques:
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
How can Bayesian methods transform healthcare from reactive to proactive?
From MYCIN’s rule-based approach in the 1970s to modern Bayesian AI
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Healthcare generates massive amounts of data:
But clinicians are overwhelmed and critical events are missed
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
How do we transform raw healthcare data into actionable insights that save lives?
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Founded by: Dr. Suchi Saria (Johns Hopkins)
Mission: Transform healthcare data into clinical insights using adaptive AI
Key Innovation: Active Clinical Awareness platform
Approach: Bayesian probabilistic models for: - Early warning systems - Sepsis detection - Pressure ulcer prevention - Clinical deterioration prediction
Recent Recognition:
Clinical Deployment: Cleveland Clinic system-wide expansion
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Traditional AI (Rules-Based):
IF (Temperature > 38°C AND Heart_Rate > 100)
THEN Alert = "Possible Sepsis"
Problems: - Brittle rules - No uncertainty quantification - Can’t learn from data - High false positive rates
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Key Advantage: Updates beliefs as new evidence arrives
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Combines prior medical knowledge with real-time patient data to provide probabilistic risk scores
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Sepsis: Life-threatening organ dysfunction caused by infection
The Challenge: Early detection is critical but difficult
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
SIRS Criteria (Systemic Inflammatory Response Syndrome):
At least 2 of: - Temperature < 36°C or > 38°C - Heart rate > 90 bpm - Respiratory rate > 20/min - WBC < 4,000 or > 12,000 cells/mm³
Problems: - Low specificity (many false positives) - Detected too late - Doesn’t account for patient-specific factors - Rule-based, not probabilistic
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Patient: 68-year-old male, post-surgery day 3
Current Status: - Temperature: 37.8°C (slightly elevated) - Heart Rate: 95 bpm (slightly elevated) - Blood Pressure: 110/70 (normal) - Recent trend: HR increasing from 85 to 95 over 6 hours - Labs: WBC 11,500 (borderline), Lactate 1.8 mmol/L
Question for Groups:
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Assign roles: Facilitator, Note-taker, Timekeeper, Reporter
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Consider these perspectives:
Clinical Perspective: - What subtle patterns might indicate early sepsis? - How do trends matter vs. single measurements?
Statistical Perspective: - How do we quantify uncertainty? - What’s the cost of false positives vs. false negatives?
ML/AI Perspective: - What features should the model learn? - How do we update predictions in real-time?
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Each group shares (2-3 min each):
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
After presentations, class discussion:
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Ethics & Trust: - Should algorithms override clinical judgment? - How transparent should the model be?
Implementation: - How to reduce alert fatigue? - Integration with existing workflows?
Equity: - Do Bayesian priors perpetuate bias? - Performance across diverse populations?
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
TREWS: Targeted Real-time Early Warning Score
Published in Nature Medicine (2022)
Key Innovation: Patient-specific dynamic risk assessment
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
%%| fig-width: 6
%%| fig-align: center
graph TB
PH[Patient History] --> Prior[Prior Risk]
VS[Vital Signs] --> Likelihood[Likelihood]
Labs[Lab Results] --> Likelihood
Prior --> Post[Posterior Risk]
Likelihood --> Post
Post --> Alert{Alert Threshold}
Alert -->|High Risk| Notify[Notify Clinician]
Alert -->|Low Risk| Monitor[Continue Monitoring]
Advantages over simple ML: - Incorporates domain knowledge - Quantifies uncertainty - Handles missing data naturally - Interpretable reasoning chain
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Hierarchical Bayesian Model:
Level 1 - Patient-specific parameters:
Level 2 - Population parameters:
Level 3 - Observations:
where: - = patient-specific parameters - = population-level hyperparameters
- = outcome at time for patient - = observed features
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Prior Probability (before new labs):
New Evidence: Lactate = 2.5 mmol/L
Posterior Probability:
Risk increases from 3% to 17.8% with new evidence!
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Hour 1: Prior risk = 3%
Hour 2: New HR trend → Posterior = 8% (becomes new prior)
Hour 3: New lab results → Posterior = 18%
Hour 4: BP drops → Posterior = 45% → ALERT!
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Each new piece of evidence updates the probability, incorporating the full history
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Unlike point predictions, Bayesian methods provide credible intervals:
“We are 95% confident the true risk is between 35% and 55%”
Clinical Value: - High uncertainty → gather more data before acting - Low uncertainty → confident in recommendation - Transparent about what model doesn’t know
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Study: Randomized controlled trial at Johns Hopkins
TREWS vs. Standard Care:
| Metric | Standard Care | TREWS | p-value |
|---|---|---|---|
| Time to antibiotics | 4.2 hours | 2.8 hours | < 0.001 |
| In-hospital mortality | 18.3% | 14.2% | 0.021 |
| ICU length of stay | 5.8 days | 4.9 days | 0.015 |
| False alert rate | N/A | 12% | - |
Key Finding: 1.3 hours faster treatment, 4.1% absolute mortality reduction
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Problem: Pressure ulcers affect 2.5 million patients/year in US
Bayesian Approach: - Real-time risk assessment every 30 minutes - Incorporates: mobility, nutrition, tissue perfusion, medical devices - Predicts risk 12-24 hours in advance
Model:
Results: - 40% reduction in hospital-acquired pressure ulcers - Proactive interventions (repositioning, support surfaces)
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Rule-Based System (SIRS)
IF (Temp > 38 AND HR > 90)
THEN Risk = "High"
ELSE Risk = "Low"
Limitations: - Binary output (yes/no) - No confidence measure - Ignores patient context - Static thresholds - High false positive rate (40-60%)
Bayesian System (TREWS)
Risk = P(Sepsis | All data)
Risk ∈ [0, 1] with confidence interval
Advantages: - Probabilistic output - Quantifies uncertainty - Patient-specific - Adaptive thresholds - Lower false positive rate (12%)
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Top 10 Predictive Features in TREWS:
Bayesian Model automatically weights features based on: - Information gain - Uncertainty reduction - Interaction effects
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
In Healthcare: 30-40% of EHR data is missing!
Traditional ML: - Delete rows (lose data) - Impute with mean (lose variance) - Create missing indicators
Bayesian Approach: - Treat missing data as latent variables - Marginalize over possible values weighted by probability
Result: Uses partial information optimally without discarding data
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Calibration Plot: Do predicted probabilities match observed frequencies?
TREWS Calibration: - When model says 30% risk → observed frequency is 28-32% - Well-calibrated across risk spectrum
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Static Model: Single risk score
Dynamic Bayesian Model: Risk evolves over time
%%| fig-width: 8
%%| fig-align: center
graph LR
R0[Risk t=0] --> R1[Risk t=1]
R1 --> R2[Risk t=2]
R2 --> R3[Risk t=3]
D1[Data t=1] --> R1
D2[Data t=2] --> R2
D3[Data t=3] --> R3
Dynamic Model captures: - Trends (increasing/decreasing) - Rates of change - Temporal patterns - Recovery trajectories
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Problem: Too many alerts → clinicians ignore them
Bayesian Solution: - Threshold optimization: - Multi-level alerts based on uncertainty - Personalized to unit/clinician
Alert Strategy:
| Risk Level | Action | False Positive Rate |
|---|---|---|
| < 20% | Monitor only | - |
| 20-40% | Soft alert to nurse | 15% |
| 40-60% | Alert to physician | 8% |
| > 60% | Urgent alert + auto-page | 5% |
Result: 60% reduction in alert fatigue vs. SIRS criteria
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Critical Question: Do Bayesian priors perpetuate healthcare disparities?
Potential Issues: - Historical data reflects biased treatment patterns - Different baseline risks across populations - Access to care differences
Bayesian Health’s Approach: - Stratified validation across demographics - Audit for differential performance - Adjust priors based on social determinants of health - Transparency in feature importance
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Scale of Implementation:
Technical Infrastructure: - Real-time EHR integration (Epic) - <5 minute latency for predictions - Dashboard integration - Mobile alerts
Key to Success: - Clinician buy-in through co-design - Workflow integration - Continuous learning from feedback - Performance monitoring
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Clinicians need to understand WHY the model alerts
TREWS provides:
SEPSIS RISK: 52% (High)
Top Contributing Factors:
1. Lactate increasing: 1.2 → 2.5 mmol/L (+35% risk)
2. Heart rate trend: 85 → 105 bpm (+12% risk)
3. Recent surgery (2 days ago) (+8% risk)
4. Age-adjusted baseline (+5% risk)
Alternative explanations considered:
- Post-surgical inflammation (22% probability)
- Pain response (15% probability)
Bayesian framework naturally supports explainability through probabilistic reasoning chains
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
From Lecture 1-6:
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
This case study demonstrates how foundational Bayesian concepts directly translate to life-saving applications
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Research Challenges:
Emerging Applications: - ICU deterioration prediction - Post-discharge monitoring - Medication response prediction - Surgical complication forecasting
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Bayesian methods provide principled uncertainty quantification - critical for medical decisions
Sequential updating enables real-time risk assessment - catches deterioration early
Probabilistic framework handles missing data naturally - common in healthcare
Calibrated probabilities enable better decision-making - transparent about confidence
Implementation requires careful attention to clinical workflow - technology alone insufficient
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Consider the trade-offs:
A Bayesian early warning system has: - 85% sensitivity (catches 85% of sepsis cases) - 88% specificity (12% false positive rate)
Questions:
Form pairs and discuss for 5 minutes, then share with class
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
FDA Regulation: - Bayesian Health’s platform is FDA-cleared - Classified as Software as Medical Device (SaMD) - Requires continuous monitoring and updates
Ethical Framework: - Beneficence: Does it improve outcomes? - Non-maleficence: Potential for harm from false alerts? - Autonomy: Preserves clinician decision-making? - Justice: Fair across patient populations?
Ongoing Debate: Should AI systems be held to higher standards than human clinicians?
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Cost-Benefit Analysis (per 1000 patients):
Costs: - Platform license: $500K/year - Implementation: $200K - Training: $50K - Maintenance: $100K/year
Benefits: - Lives saved: 40 patients (@ $10M VSL) = $400M - Reduced ICU days: 1000 days × $3K = $3M - Reduced readmissions: 50 × $15K = $750K - Efficiency gains: $500K
Net benefit: Substantial even without valuing lives
Historical teaching case. Clinical or company claims require source review before reuse as current evidence. The supplied numbers are not clinical guidance. The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Bayesian Health vs. Other Approaches:
| Application | Method | Uncertainty | Interpretability | Deployment |
|---|---|---|---|---|
| Bayesian Health | Bayesian Networks | ✓✓✓ | ✓✓✓ | System-wide |
| Google DeepMind (Sepsis) | Deep Learning | ✓ | ✓ | Limited |
| Epic Sepsis Prediction | Logistic Regression | ✓✓ | ✓✓✓ | Widespread |
| IBM Watson Health | Rule-based + ML | ✓ | ✓✓ | Discontinued |
Bayesian Advantage: Best combination of performance and interpretability
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
What Made Bayesian Health Successful:
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Technology + Clinical workflow + Organizational change = Impact
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Take 3 minutes to write:
One concept from Bayesian statistics you now understand better through this case study
One question you still have about implementation
One other domain where similar Bayesian methods could be applied
Share with a partner, then volunteers share with class
The numerical Bayes exercise is illustrative. Do not infer that the named deployed system uses this exact probabilistic architecture.
Mini-Project Ideas:
Datasets: - MIMIC-III (ICU data) - eICU Collaborative Research Database - UK Biobank
State the unit of observation and the intended prediction time.
Specify the split, baseline, and comparison metric.
Name one plausible leakage route and how you will check it.
A model has almost zero training error and a large validation error. What would you investigate?
A model does well on a random split but poorly on the next year. What might differ?
Which part of your project’s evaluation could fail even if every line of code runs correctly?
Ridge regularization and stability under data perturbations.
What could make the fitted curve less sensitive to small changes in the responses?
The first term rewards agreement with observed responses.
The second discourages large coefficients.
The intercept is unpenalized in this experiment.
Use degree-12 polynomial features in every fit.
Keep the training/validation split and response scale fixed.
Vary only .
This experiment isolates the effect of the penalty.
The same relationship can have very different numerical coefficients.
| Input unit | Same prediction | Squared coefficient |
|---|---|---|
| Meters | ||
| Millimeters |
Which part of the curve suggests too much constraint?
Why aren’t these automatically confidence bands?
If two feature columns are identical, which coefficients would ridge prefer?
As becomes very large, the penalized coefficients approach zero.
With an unpenalized intercept, predictions approach a constant fitted from the training responses.
Why can that be a useful baseline and a poor final predictor?
Record the chosen setting and its rationale.
Then reveal the common regression test result once.
If the result disappoints, report that evidence. Changing the model in response makes this test part of another selection cycle.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
The source’s shrinkage illustration is not by itself a computation of the full horseshoe posterior mean.
The horseshoe prior provides adaptive shrinkage through a hierarchical Bayesian framework. For a linear model with response (y_i) and covariates (x_i ^p), the horseshoe prior is specified as:
Here are local shrinkage parameters (one per coefficient), is the global shrinkage parameter controlling overall sparsity.
The source’s shrinkage illustration is not by itself a computation of the full horseshoe posterior mean.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
| Scenario | Recommended Method | Rationale |
|---|---|---|
| , stable | Ridge | Numerical stability |
| , sparse | Lasso, Horseshoe | Variable selection |
| Ultra-sparse | Spike-and-slab | Exact sparsity |
| Correlated predictors | Bridge, Bayesian | Handle correlation |
| Uncertainty needed | Full Bayesian | Credible intervals |
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Expression
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
graph TD
A[Data] --> B[Exploratory Analysis]
B --> C[Train/Validation Split]
C --> D[Model Selection]
D --> E[Hyperparameter Tuning]
E --> F[Cross-Validation]
F --> G[Final Model]
G --> H[Test Set Evaluation]
D --> D1[Ridge]
D --> D2[Lasso]
D --> D3[Bridge]
D --> D4[Bayesian]
F --> F1[K-fold CV]
F --> F2[Time Series CV]
F --> F3[Nested CV]
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Double descent is a phenomenon of over-parameterized statistical models that challenges traditional bias-variance intuition. Over-parameterized models such as deep neural networks have an interesting re-descending property in their risk characteristics.
As model complexity increases:
This phenomenon was first observed in linear regression and later in deep learning contexts.
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
The curve shows two distinct phases:
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Modern machine learning practice increasingly uses over-parameterized models with parameters far exceeding the number of observations. Examples include large language models, image processing networks, and generative AI methods.
Key insights:
Practical implication: Instead of carefully tuning to find optimal complexity, over-parameterize and get good performance automatically!
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
We demonstrate double descent using polynomial regression with a sinusoidal target function .
Setup:
Small sample size is crucial for observing double descent, creating a regime where parameters can substantially exceed observations.
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
#| code-fold: true
#| code-summary: "Python Setup"
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(42)
def sin_func(x):
return np.sin(5*x)
G = np.polynomial.legendre.legvander
def poly(pts, beta, d):
return G(pts, d).dot(beta)
n = 20
sigma = 0.3
a, b = -1, 1
ground_truth = sin_func
x = np.linspace(a, b, n)
y = ground_truth(x) + sigma * np.random.normal(size=n)
xdense = np.linspace(a, b, 100)
ygt = ground_truth(xdense)
def fit(d):
betaHat = np.linalg.pinv(G(x, d)).dot(y)
mseos = np.sqrt(np.mean((G(xdense, d).dot(betaHat) - ygt)**2))
mseis = np.sqrt(np.mean((G(x, d).dot(betaHat) - y)**2))
return betaHat, mseos, mseis
def run(d, ax):
betaHat, mseos, mseois = fit(d)
ax.plot(xdense, ygt, label='ground-truth')
ax.scatter(x, y, c='r', label='samples')
ax.plot(xdense, poly(xdense, betaHat, d), label='model')
ax.set_ylim(-2, 2)
ax.axis('off')
ax.legend()
ax.set_title('d=%d, MSE: Test=%.2f, Train=%.2f' % (d, mseos, mseois))#| code-fold: true
#| label: fig-double-descent-grid
#| fig-cap: "Four representative polynomial degrees showing double descent phases"
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
fig.suptitle('Double Descent: Polynomial Regression', fontsize=16)
run(1, axes[0, 0]) # Underparameterized
run(5, axes[0, 1]) # Classical optimum
run(20, axes[1, 0]) # Interpolation threshold
run(50, axes[1, 1]) # Over-parameterized
plt.tight_layout()
plt.show()Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Degree 1 (Underparameterized): Linear model too simple to capture oscillatory sine function. High bias, poor fit to both training and test data.
Degree 5 (Classical Optimum): Sweet spot of traditional bias-variance tradeoff. Sufficient complexity to capture main features without severe overfitting.
Degree 20 (Interpolation Threshold): Exactly as many parameters as observations, enabling perfect interpolation. Wild oscillations between data points lead to poor generalization.
Degree 50 (Over-parameterized): Despite having far more parameters than observations, achieves better test performance than interpolating model. This is the double descent effect!
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
#| code-fold: true
#| label: fig-mse-curve
#| fig-cap: "Training and test MSE across polynomial degrees showing double descent"
nd = 50
mse_test = np.zeros(nd)
mse_train = np.zeros(nd)
for d in range(1, nd):
betaHat, mseos, mseois = fit(d)
mse_test[d] = mseos
mse_train[d] = mseois
fig, ax1 = plt.subplots(figsize=(10, 6))
ax1.set_xlabel('Polynomial Degree (Model Complexity)', fontsize=12)
ax1.set_ylabel('log10(MSE)', color='black', fontsize=12)
ax1.plot(np.log10(mse_test), color='blue', linewidth=2, label='Test MSE')
ax2 = ax1.twinx()
ax2.set_ylabel('log10(Train MSE)', color='red', fontsize=12)
ax2.plot(np.log10(mse_train), color='red', linewidth=2, label='Train MSE')
ax2.tick_params(axis='y', labelcolor='red')
lines1, labels1 = ax1.get_legend_handles_labels()
lines2, labels2 = ax2.get_legend_handles_labels()
ax1.legend(lines1 + lines2, labels1 + labels2, loc='upper right')
plt.title('Double Descent Phenomenon in Polynomial Regression')
plt.tight_layout()
plt.show()The test error (blue line) exhibits characteristic double descent shape with three phases:
Classical Regime (): Increasing model complexity reduces both bias and test error. Traditional understanding of bias-variance tradeoff applies.
Interpolation Crisis (): Test error peaks dramatically as model perfectly fits training data while generalizing poorly. This is where classical theory predicts catastrophic overfitting.
Over-parameterized Regime (): Test error decreases again! Extreme over-parameterization leads to improved generalization despite ability to memorize training data.
The double descent phenomenon arises from implicit regularization effects of minimum-norm solutions in over-parameterized settings.
When , the pseudoinverse solution corresponds to minimum -norm coefficients among all possible interpolating solutions. This implicit bias toward simpler functions leads to surprisingly good generalization.
Mathematical insight: Among infinitely many solutions that perfectly fit the data, we automatically select the one with smallest coefficients, providing implicit regularization without explicit penalties.
Connection to deep learning: Similar implicit regularization occurs in over-parameterized neural networks through gradient descent dynamics.
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Double descent has a natural Bayesian interpretation and is not in conflict with Occam’s razor that Bayesian models possess.
Occam’s Razor: Bayesian methods naturally favor simpler models through the marginal likelihood, penalizing complexity via corrections like BIC.
Reconciliation: Even though Bayesian methods shift posterior toward lower-complexity models, highly parameterized Bayesian models can have good risk properties due to the conditional prior of parameters given the model.
The key is that over-parameterized models don’t necessarily have high effective complexity when properly regularized (implicitly or explicitly).
The double descent phenomenon has significant practical implications for modern machine learning:
Model selection strategy: Given that finding the “sweet spot” is time-consuming and computationally expensive, over-parameterization provides good performance automatically without careful tuning.
Generality: Observed across wide range of models including deep neural networks, random forests, kernel methods, and linear models.
Challenge to intuition: Classical statistical wisdom about model complexity doesn’t apply in contemporary settings with over-parameterized models.
Modern AI success: Helps explain why massive models (GPT, BERT, etc.) generalize well despite billions of parameters.
Setup:
Goal: Estimate under squared loss
MLE:
Risk: (constant!)
For , the MLE is inadmissible under squared error loss!
There exist estimators with uniformly lower risk than MLE.
James-Stein Estimator:
Risk: for all
Key insight: Multivariate estimation is easier than univariate when using appropriate shrinkage!
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Hierarchical Model:
Empirical Bayes: - Estimate - Estimate from data - Use in posterior mean calculation
Result: Closely related to James-Stein estimator
James-Stein Risk Calculation:
Horseshoe Posterior Mean: where depends on and
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
MCMC for Horseshoe:
Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
#| echo: false
import numpy as np
import numpy.random as rand
import numpy.linalg as la
import matplotlib.pyplot as plt
# Set random seed for reproducibility
np.random.seed(42)
# Functions
def arctan_gt(x):
return np.arctan(5*x)
def cubic_gt(x):
return poly(x, np.array([0, -1, 0, 1]), 3)
def relu(x):
return x*(x >= 0)
def sin(x):
return np.sin(5*x)
def Vand(x, d):
"""Vandermonde matrix for pts x, to degree d"""
X = np.array([x**i for i in range(0, d+1)]).T
return XInspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
#| code-fold: true
n = 20 # number of samples
sigma = 0.3 # stdev of noise
a = -1
b = 1 # range of x values
# Use Legendre polynomial basis by default
G = np.polynomial.legendre.legvander
def poly(pts, beta, d):
return G(pts, d).dot(beta)
# Initialize data
ground_truth = sin
x = np.linspace(a, b, n)
y = ground_truth(x) + sigma * np.random.normal(size=n)
xdense = np.linspace(a, b, 100)
ygt = ground_truth(xdense)
# Core functions
def solve_reg(A, y, lamb):
return la.solve(A.T.dot(A) + lamb * np.identity(A.shape[1]), A.T.dot(y))
def fit(d):
betaHat = la.pinv(G(x, d)).dot(y)
mseos = np.sqrt(np.mean((G(xdense, d).dot(betaHat) - ygt)**2))
mseis = np.sqrt(np.mean((G(x, d).dot(betaHat) - y)**2))
return betaHat, mseos, mseis
def run(d, ax):
"""Compute the regressor for degree d, and plot the solution."""
betaHat, mseos, mseois = fit(d)
ax.plot(xdense, ygt, label='ground-truth')
ax.scatter(x, y, c='r', label='samples')
ax.plot(xdense, poly(xdense, betaHat, d), label='model')
ax.set_ylim(-2, 2)
ax.axis('off')
ax.legend()
ax.set_title('d=%d, MSE: Test=%.2f, Train=%.2f' % (d, mseos, mseois))Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
#| code-fold: true
#| label: fig-double-descent-grid
#| fig-cap: "Double Descent Phenomenon: Polynomial Regression with Different Degrees"
# Create 2x2 subplot grid
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
fig.suptitle('Double Descent Phenomenon: Polynomial Regression', fontsize=16)
# Plot each degree in its respective subplot
run(1, axes[0, 0]) # Top left
run(5, axes[0, 1]) # Top right
run(20, axes[1, 0]) # Bottom left
run(50, axes[1, 1]) # Bottom right
plt.tight_layout()
plt.show()Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Original code uses its source lesson’s setup and data. Saved outputs, where shown, were not rerun for this edition.
#| code-fold: true
#| label: fig-mse-curve
#| fig-cap: "Bias-Variance Trade-off: Training and Test MSE vs Model Complexity"
# Generate MSE data for different polynomial degrees
nd = 50
mse1 = np.zeros(nd) # Test MSE
mse2 = np.zeros(nd) # Train MSE
for d in range(1, nd):
betaHat, mseos, mseois = fit(d)
mse1[d] = mseos
mse2[d] = mseois
fig, ax1 = plt.subplots()
ax1.set_xlabel('Number of Features')
ax1.set_ylabel('MSE', color='black')
ax1.plot(np.log10(mse1), color='blue', label='out-of-sample')
ax2 = ax1.twinx()
ax2.plot(np.log10(mse2), color='red', label='in-sample')
fig.legend()Inspect the actual experiment. A named regime or curve is not a universal result. Separate interpolation, noise fitting, extrapolation, basis conditioning and floating-point effects.
Classical Regime (): Traditional bias-variance tradeoff
Interpolation Crisis (): Test error peaks at perfect fit
Over-parameterized Regime (): Test error decreases with extreme over-parameterization
Key insight: Implicit regularization through minimum-norm solutions
Show the baseline and one alternative under the agreed evaluation design.
Explain the strongest check that could have failed.
Identify one remaining uncertainty that matters to the recommendation.
Why should feature units matter to ridge?
Why would selecting using training error defeat the purpose?
What remains when the penalty is huge and the intercept is unpenalized?
How would you distinguish a poor constraint from an optimizer that failed?
AII 600