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
Price
$24 one-time
Chapters
18 chapters
Machine Learning from Scratch, Volume 2: Linear and Generalized Linear Models cover

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

Read the chapter

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.

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-time

Version 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 editions

Also in the series

Explore the other volumes

Version 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
  1. 2026.08.1

    Editorial refinements, restored plot typography, clearer logarithmic axes, and refreshed companion code.

  2. 2026.08.0

    Editorial improvements throughout the book, with clearer explanations, refined presentation, improved plots and visualizations, and refreshed companion code.

  3. 2026.07.2

    Improved companion notebooks and validation; removed the obsolete CLT appendix; updated the support contact.

  4. 2026.07.1

    Validation edition bump: fixed typos in the SSE chapter.

  5. 2026.07.0

    Initial public PDF and companion-code release.