Volume 2 of 4 · PDF edition
Linear and Generalized Linear Models
Linear models built from first principles: model fundamentals and diagnostics, OLS through polynomial and spline regression, ridge, lasso, and elastic net, then logistic, multinomial, and Poisson regression unified under the GLM framework.
One part of Machine Learning from Scratch. The complete book remains free to read online; this paid edition is the carefully typeset PDF and companion notebook package you keep.
- Pages
- 461 pages
- Edition
- Version 2026.08.2
- Price
- $24 one-time
- Chapters
- 18 chapters

Learning outcomes
What you will learn
- Derive linear regression from the loss function and diagnose when its assumptions fail.
- Build simple, multiple, polynomial, and spline regression models from first principles.
- Control variance with ridge, lasso, and elastic-net regularization.
- Choose and interpret logistic, multinomial, Poisson, and generalized linear models for different response types.
Audience and prerequisites
Who this volume is for
- Data scientists who want to understand regression beyond library calls.
- Machine-learning practitioners working with interpretable predictive models and structured data.
- Students preparing for advanced modeling, econometrics, or applied statistics.
Prerequisites: Assumes the statistical foundations and inference concepts covered in Volume 1.
Free online preview
Start with “Simple Linear Regression”
Mathematical foundations, formulas, and step-by-step implementation
Approximately 48 minutes
Exact contents
18 chapters across 2 parts
Every chapter below is included in the PDF and companion code. Links open the corresponding chapter in the free online edition.
Model Fundamentals and Diagnostics
Linear and Generalized Linear Models
- 01Simple Linear Regression
- 02Ordinary Least Squares (OLS)
- 03Multiple Linear Regression
- 04Polynomial Regression
- 05Spline Regression
- 06Ridge Regularization (L2 Regularization)
- 07Lasso Regularization (L1 Regularization)
- 08Elastic Net Regularization
- 09Logistic Regression
- 10Multinomial Logistic Regression
- 11Poisson Regression
- 12Generalized Linear Models
Volume 2 PDF + code
Own this 461-page edition
Get the PDF, the runnable companion notebooks, and every future update and erratum for this volume. The corresponding online chapters stay free to read.
- Carefully typeset PDF
- Companion code for every included chapter
- Future updates and errata included
- Online chapters remain free to read
Volume 2 of 4
$24
one-timeVersion 2026.08.2 · 461 pages · secure checkout via Stripe
Delivered by email · Free updates included
Compare editions
This volume or the complete book?
Volume 2: Linear and Generalized Linear Models
461 pages focused on Model Fundamentals and Diagnostics and Linear and Generalized Linear Models. Best when this is the subject you need now.
$24
The complete Machine Learning from Scratch book
All four volumes in one 1,717-page PDF, with the complete companion code. Buying three distinct volumes also unlocks the complete book automatically.
$68
Compare all PDF editionsAlso in the series
Explore the other volumes
Volume 1 · 402 pages
Statistical Foundations and Hypothesis Testing
Statistical Foundations for Machine Learning · Hypothesis Testing
Explore Volume 1Volume 3 · 503 pages
Trees, Explainability, and Unsupervised Learning
Tree-Based Models · Explainability and Dimensionality Reduction · Unsupervised Learning
Explore Volume 3Volume 4 · 408 pages
Forecasting and Optimization
Time Series Forecasting · Optimization
Explore Volume 4Version history
Kept current, not frozen in time
Each PDF purchase includes future editions. When the book changes, the updated copy appears in My books at no extra cost.
Current release
Edition 2026.08.2
Editorial improvements.
Earlier releases5
2026.08.1
Editorial refinements, restored plot typography, clearer logarithmic axes, and refreshed companion code.
2026.08.0
Editorial improvements throughout the book, with clearer explanations, refined presentation, improved plots and visualizations, and refreshed companion code.
2026.07.2
Improved companion notebooks and validation; removed the obsolete CLT appendix; updated the support contact.
2026.07.1
Validation edition bump: fixed typos in the SSE chapter.
2026.07.0
Initial public PDF and companion-code release.