No. 253 of 500 No. 32 in Hands-On AI & Programming

Data Science from Scratch

First Principles with Python

By Joel Grus

Published
June 11, 2019
Print length
403 pages
Reading level
Intermediate
ISBN-13
978-1492041139
Publisher
O'Reilly Media
Written for
Programmers with some Python who want to understand machine learning algorithms by building them.

Synopsis

Joel Grus wrote Data Science from Scratch on the premise that people understand statistical and machine learning methods best when they build them by hand before relying on libraries. The book opens with a crash course in Python and then implements, in plain code, the linear algebra, statistics, probability and gradient descent that underpin the field. From there it constructs working versions of k-nearest neighbors, naive Bayes, linear and logistic regression, decision trees, neural networks and clustering, alongside chapters on collecting and cleaning data, visualization, recommender systems, network analysis and natural language processing.

The 2019 second edition, the current version, moves the code to Python 3.6 with type annotations, repairs broken examples and adds chapters on deep learning and data ethics. Its deep learning chapter builds a small neural network library from first principles, and the language chapter now covers word vectors and recurrent networks. The code is written for teaching rather than production, and Grus keeps the tone conversational and often funny. Readers finish with a working mental model of what libraries such as scikit-learn and PyTorch do internally, which makes later work with those tools far less opaque.

Scorecard

Editorial score

How it scored

Editorial score: 70.5 / 1005 weighted criteria

  • Influence30%

    22.5/30
  • Authority25%

    17.5/25
  • Practical value20%

    15.0/20
  • Currency15%

    7.5/15
  • Readability10%

    8.0/10
  • Editorial score

    70.5/100

How the rank was computed

Rank No. 253 of 500 comes from a composite of 54.6: observable signals 22.8 of 55 points plus editorial review 31.8 of 45 points.

All 11 inputs
InputPoints
Observable signals22.8/55
Reach (Amazon ratings volume)10.6/16.5
Consensus across best-of lists5.5/13.8
Awards and bestseller evidence0.0/8.3
Reader rating, sample-adjusted5.5/8.3
Amazon sales rank1.2/5.5
Recency0.0/2.8
Editorial review31.8/45
Author authority7.9/11.3
Influence10.1/13.5
Practical value6.8/9.0
Readability3.6/4.5
Currency3.4/6.8

Each criterion is scored from 1 to 10 and weighted, and the points add up to the editorial score. The rank combines observable signals (55 percent) with this score (45 percent). Read the methodology.

Verdict

A clear, code-first tour of data science fundamentals that builds understanding by implementing each core algorithm in plain Python.

Strengths

  • Readable, well-commented teaching code
  • Builds math foundations alongside algorithms
  • Second edition adds deep learning and ethics

Keep in mind

The from-scratch code is deliberately slow and unsuited to production, and the 2019 edition predates transformers, large language models and current library practice.

Key takeaways

  1. Implementing an algorithm by hand, even inefficiently, exposes assumptions and failure modes that a single library call keeps hidden.
  2. Linear algebra, probability, statistics and gradient descent form the shared foundation beneath nearly every model the book builds.
  3. Much of practical data science is collecting, cleaning and reshaping data, work that deserves as much care as choosing a model.
  4. A neural network is a composition of simple, testable layers and loss functions that a programmer can build and train from scratch.

Notable facts

  • The 2019 second edition moved the code from Python 2.7 to Python 3.6 and added new chapters on deep learning and data ethics. Source (opens in a new tab)

About the author

Joel Grus

Joel Grus is a software engineer and data scientist who was a research engineer at the Allen Institute for Artificial Intelligence in Seattle, where he worked on the AllenNLP deep learning library for natural language processing research. He previously worked as a software engineer at Google and as a data scientist at several startups, and is known for livecoding videos and conference talks.

Questions

Is Data Science from Scratch worth reading in 2026?
It remains useful for understanding fundamentals, because the math and algorithms it builds have not changed. The 2019 second edition predates transformers and large language models, so readers who want current deep learning or generative AI practice should follow it with a newer text. As a way to see inside k-nearest neighbors, regression, decision trees and basic neural networks, it still works well.
Do I need math or Python experience for Data Science from Scratch?
Some programming experience helps, and the book includes a quick Python primer. It does not assume prior training in machine learning mathematics; instead it builds the needed linear algebra, statistics and probability in code. Readers comfortable with high school algebra and basic programming can follow most chapters, though the later chapters on neural networks demand extra patience.
What changed in the second edition of Data Science from Scratch?
The first edition, published in 2015, used Python 2.7. The 2019 second edition updates the code to Python 3.6, adds type annotations and more tests, replaces broken examples, swaps a homemade digit dataset for MNIST, and adds new chapters on deep learning and data ethics. The natural language processing chapter was also rebuilt on the new deep learning code.

Sources

As an Amazon Associate, Best AI Books earns from qualifying purchases. Best AI Books is sponsored by Iternal.ai, whose founder and CEO, John Byron Hanby IV, wrote The AI Strategy Blueprint, our #1 ranked book. How we rank books.