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 this (you can omit the print function in interactive mode):
from scratch.linear_algebra import distance, vector_mean
v = [1, 2, 3]
w = [4, 5, 6]
print( distance(v, w) )
print( vector_mean([v, w]) )
Two notes:
-
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 thescratch
directory itself, the imports won't work. -
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
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.
Additionally, I've collected all the links from the book.
And, by popular demand, I made an index of functions defined in the book (which might be outdated), by chapter and page number (of the english version of the book). The data is in a spreadsheet. I also made a toy (experimental) searchable webapp.
- Introduction
- A Crash Course in Python
- Visualizing Data
- Linear Algebra
- Statistics
- Probability
- Hypothesis and Inference
- Gradient Descent
- Getting Data
- Working With Data
- Machine Learning
- k-Nearest Neighbors
- Naive Bayes
- Simple Linear Regression
- Multiple Regression
- Logistic Regression
- Decision Trees
- Neural Networks
- Deep Learning
- Clustering
- Natural Language Processing
Natural Language Processing Advanced - Network Analysis
- Recommender Systems
- Databases and SQL
- MapReduce
- Data Ethics
- Go Forth And Do Data Science