Generalized Linear Models › Visualizing GLMs

Michael BrenndoerferApril 1, 20252 min read
Machine Learning from ScratchAll chapters
Part 4 of 9Regression Models
Chapter 40Generalized Linear Models › Visualizing GLMs
Reading section 7 of 12 · Visualizing GLMs · 2 minSection 7 of 12 · 2 min

Book contents

Section 7 of 12 · 2 min read

Generalized Linear Models › Visualizing GLMsOne section · Sections in this chapter7 / 12 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

The following visualizations demonstrate how different link functions transform the linear predictor to produce the expected response. Each GLM type uses a specific link function that is mathematically appropriate for its target distribution. The identity link maintains linearity for continuous normal data, the logit link produces S-shaped probabilities for binary outcomes, and the log link ensures positive predictions for count data.

Out[7]:
Visualization
Blue diagonal identity-link line across linear predictor eta from minus four to four and expected response mu on the same unbounded scale.
Identity link function for linear regression. The linear predictor η maps directly to the expected response μ without mapping (μ = η), maintaining a one-to-one linear relationship suitable for continuous, unbounded outcomes.
Coral S-shaped inverse-logit curve across eta from minus four to four, with expected response constrained from zero to one.
Logit link function for logistic regression. The inverse logit (logistic sigmoid) maps the unbounded linear predictor η into probabilities between 0 and 1 using μ = 1/(1 + e^(-η)), creating the characteristic S-shaped curve.
Teal exponential inverse-log curve across eta from minus four to four, with the displayed expected-response range retained from zero to ten.
Log link function for Poisson regression. The exponential function maps the linear predictor η into strictly positive expected counts using μ = e^η.