Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

data-science-from-scratch

> 编程语言
Open source

code for Data Science From Scratch book

9.7K stars0 likes2 views
WebsiteGitHub

About

code for Data Science From Scratch book

Data Science from Scratch

Here's all the code and examples from the second edition of my book Data Science from Scratch. They require at least Python 3.6.

(If you're looking for the code and examples from the first edition, that's in the first-edition folder.)

If you want to use the code, you should be able to clone the repo and just do things like

In [1]: from scratch.linear_algebra import dot

In [2]: dot([1, 2, 3], [4, 5, 6])
Out[2]: 32

and so on and so forth.

Two notes:

  1. In order to use the library like this, you need to be in the root directory (that is, the directory that contains the scratch folder). If you are in the scratch directory itself, the imports won't work.

  2. It's possible that it will just work. It's also possible that you may need to add the root directory to your PYTHONPATH, if you are on Linux or OSX this is as simple as

bash
export PYTHONPATH=/path/to/where/you/cloned/this/repo

(substituting in the real path, of course).

If you are on Windows, it's potentially more complicated.

Table of Contents

  1. Introduction
  2. A Crash Course in Python
  3. Visualizing Data
  4. Linear Algebra
  5. Statistics
  6. Probability
  7. Hypothesis and Inference
  8. Gradient Descent
  9. Getting Data
  10. Working With Data
  11. Machine Learning
  12. k-Nearest Neighbors
  13. Naive Bayes
  14. Simple Linear Regression
  15. Multiple Regression
  16. Logistic Regression
  17. Decision Trees
  18. Neural Networks
  19. [Deep Learning]
  20. Clustering
  21. Natural Language Processing
  22. Network Analysis
  23. Recommender Systems
  24. Databases and SQL
  25. MapReduce
  26. Data Ethics
  27. Go Forth And Do Data Science

Issues· 78 open

View all issuesOpen on GitHub
  • #132

    Chapter 2 - A Crash Course into Python - Lists section errors.

    Updated Nov 30, 2025
  • #129

    [Bug] Incorrect implementation of conditional probability in Naive Bayes classifier

    Updated Nov 21, 2025
  • #128

    Data science

    Updated Mar 26, 2024
  • #125

    Brief note for "Chapter 8. Gradient Descent"

    Updated Jul 24, 2023
  • #122

    ModuleNotFoundError: No module named 'scratch'

    Updated Jul 24, 2023
  • #101

    Errata : 2nd Edition : Add

    Updated Jul 10, 2023
  • #124

    TypeError: can't multiply sequence by non-int of type 'float'

    Updated Jun 24, 2023
  • #123

    Chapter 5. Statistics, median function

    Updated May 7, 2023
  • #41

    Missing code of the introduction chapter

    Updated Apr 15, 2023
  • #120

    run results different from that in book

    Updated Mar 30, 2023

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言