Generalized Linear Models › Formula
Michael BrenndoerferApril 1, 20255 min read
Machine Learning from ScratchAll chapters Part 4 of 9Regression Models
Generalized Linear Models › FormulaOne section · Sections in this chapter4 / 12 ↓
Sections in this chapter12
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 general GLM formula can be written as:
where:
- is the expected value of the response variable given the features (the conditional mean)
- is the link function (transforms the expected response to the linear predictor scale)
- is the intercept term
- are the regression coefficients (one for each feature)
- are the feature values (predictor variables)
- is the number of features
This reads as: "The link function applied to the expected value of the response equals the linear combination of features with their coefficients."
Matrix Notation
In matrix form, the GLM can be written as:
where:
- is the vector of expected responses (one element per observation, where and )
- is the design matrix of features (each row is one observation, each column is one feature, with the first column typically being all 1s for the intercept)
- is the vector of coefficients ()
- is applied element-wise to (producing a vector where each element is )
- is the number of observations
How GLM Components Work Together
The following diagram illustrates how the three components of a GLM connect to transform input features into predictions:
Out[4]:
Visualization