How yuze-li2026/stat-learning-numpy works
This repository is a chapter-by-chapter, pure-NumPy implementation of the core algorithms in *Statistical Learning Methods* (2nd edition). The main workflow is to run a chapter demo, which prepares example data, fits or applies that chapter’s algorithm, and reports or plots results. The README documents all chapter topics and the shared cached-data helper; sampled demos confirm selected data and model calls. Most chapter implementations were not excerpted, so those are shown as documented capabilities without inferred internal links.
Main entry points: datasets.py Dataset cache · ch03-knn/model.py kNN and KD tree · ch15-svd/model.py SVD · ch16-pca/model.py PCA
Components 21
Supervised learning
- Perceptron
ch02-perceptron/model.py - kNN and KD tree
ch03-knn/model.py - Naive Bayes
ch04a-naive-bayes/model.py - Bayes estimation
ch04b-bayes-estimation/model.py - Decision trees
ch05-decision-tree/model.py - Logistic and maxent
ch06-logistic-maxent/model.py - SVM
ch07-svm/model.py - AdaBoost
ch08-boosting/model.py
Probabilistic models
- EM and mixtures
ch09-em/model.py - Hidden Markov model
ch10-hmm/model.py - Linear-chain CRF
ch11-crf/model.py
Representations and clustering
- Clustering
ch14-clustering/model.py - SVD
ch15-svd/model.py - PCA
ch16-pca/model.py - LSA
ch17-lsa/model.py - PLSA
ch18-plsa/model.py
Sampling and ranking
- MCMC samplers
ch19-mcmc/model.py - LDA
ch20-lda/model.py - PageRank
ch21-pagerank/model.py
Data support
- Dataset cache
common/datasets.py - Public datasets
Connections 7
- Public datasets → Dataset cache: downloads and caches
common/datasets.py - kNN and KD tree → Dataset cache: loads Iris
- SVD → Dataset cache: fetches image
- PCA → Dataset cache: loads Iris
- LSA → Dataset cache: fetches corpus
- LDA → Dataset cache: fetches corpus
- PageRank → Dataset cache: fetches network