# dod-o/statistical-learning-method_code architecture

> Architecture diagram of the GitHub repository dod-o/statistical-learning-method_code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dod-o/statistical-learning-method_code
- Repository: https://github.com/dod-o/statistical-learning-method_code

## Overview

This repository is an educational collection of standalone implementations of algorithms from *Statistical Learning Method*, rather than a shared training or inference application. The principal workflow is that a learner chooses an implementation, supplies or uses its example data, runs the algorithm, and inspects its predictions, metrics, or learned topics. The README documents supervised and unsupervised capabilities; the graph preserves those branches without implying that the scripts share a runtime pipeline. Source excerpts are incomplete, so relationships between internal stages are omitted where they are not evidenced.

Main entry points: [`perceptron/perceptron_dichotomy.py`](https://github.com/dod-o/statistical-learning-method_code/blob/master/perceptron/perceptron_dichotomy.py) (Perceptron), [`KNN/KNN.py`](https://github.com/dod-o/statistical-learning-method_code/blob/master/KNN/KNN.py) (K-nearest neighbors), [`NaiveBayes/NaiveBayes.py`](https://github.com/dod-o/statistical-learning-method_code/blob/master/NaiveBayes/NaiveBayes.py) (Naive Bayes), [`DecisionTree/DecisionTree.py`](https://github.com/dod-o/statistical-learning-method_code/blob/master/DecisionTree/DecisionTree.py) (Decision tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_supervised["Supervised learning"]
  node_perceptron["Perceptron"]
  node_knn["K-nearest neighbors<br/>[KNN.py]"]
  node_naivebayes["Naive Bayes<br/>[NaiveBayes.py]"]
  node_decisiontree["Decision tree<br/>[DecisionTree.py]"]
  node_logistic["Logistic regression"]
  node_maxentropy["Maximum entropy<br/>[maxEntropy.py]"]
  node_svm["Support vector machine<br/>[SVM.py]"]
  node_adaboost["AdaBoost<br/>[AdaBoost.py]"]
end

subgraph group_probabilistic["Probabilistic models"]
  node_em["EM algorithm<br/>[EM.py]"]
  node_hmm["Hidden Markov model<br/>[HMM.py]"]
end

subgraph group_unsupervised["Unsupervised learning"]
  node_kmeans["K-means clustering"]
  node_hierarchical["Hierarchical clustering"]
  node_pca["PCA<br/>[PCA.py]"]
  node_lsa["Latent semantic analysis<br/>[LSA.py]"]
  node_plsa["Probabilistic LSA<br/>[PLSA.py]"]
  node_lda["Latent Dirichlet allocation<br/>[LDA.py]"]
end

subgraph group_ranking["Ranking"]
  node_pagerank["PageRank<br/>[Page_Rank.py]"]
end

node_learner(("Learner"))

node_learner -->|"runs implementation"| node_perceptron
node_learner -->|"runs implementation"| node_knn
node_learner -->|"runs implementation"| node_naivebayes
node_learner -->|"runs implementation"| node_decisiontree
node_learner -->|"runs implementation"| node_logistic
node_learner -->|"runs implementation"| node_maxentropy
node_learner -->|"runs implementation"| node_svm
node_learner -->|"runs implementation"| node_adaboost
node_learner -->|"runs implementation"| node_em
node_learner -->|"runs implementation"| node_hmm
node_learner -->|"runs implementation"| node_kmeans
node_learner -->|"runs implementation"| node_hierarchical
node_learner -->|"runs implementation"| node_pca
node_learner -->|"runs implementation"| node_lsa
node_learner -->|"runs implementation"| node_plsa
node_learner -->|"runs implementation"| node_lda
node_learner -->|"runs implementation"| node_pagerank

click node_perceptron "https://github.com/dod-o/statistical-learning-method_code/blob/master/perceptron/perceptron_dichotomy.py"
click node_knn "https://github.com/dod-o/statistical-learning-method_code/blob/master/KNN/KNN.py"
click node_naivebayes "https://github.com/dod-o/statistical-learning-method_code/blob/master/NaiveBayes/NaiveBayes.py"
click node_decisiontree "https://github.com/dod-o/statistical-learning-method_code/blob/master/DecisionTree/DecisionTree.py"
click node_logistic "https://github.com/dod-o/statistical-learning-method_code/blob/master/Logistic_and_maximum_entropy_models/logisticRegression.py"
click node_maxentropy "https://github.com/dod-o/statistical-learning-method_code/blob/master/Logistic_and_maximum_entropy_models/maxEntropy.py"
click node_svm "https://github.com/dod-o/statistical-learning-method_code/blob/master/SVM/SVM.py"
click node_adaboost "https://github.com/dod-o/statistical-learning-method_code/blob/master/AdaBoost/AdaBoost.py"
click node_em "https://github.com/dod-o/statistical-learning-method_code/blob/master/EM/EM.py"
click node_hmm "https://github.com/dod-o/statistical-learning-method_code/blob/master/HMM/HMM.py"
click node_kmeans "https://github.com/dod-o/statistical-learning-method_code/blob/master/Clustering/K-means_Clustering/K-means_Clustering.py"
click node_hierarchical "https://github.com/dod-o/statistical-learning-method_code/blob/master/Clustering/Hierachical_Clustering/Hierachical_Clustering.py"
click node_pca "https://github.com/dod-o/statistical-learning-method_code/blob/master/PCA/PCA.py"
click node_lsa "https://github.com/dod-o/statistical-learning-method_code/blob/master/LSA/LSA.py"
click node_plsa "https://github.com/dod-o/statistical-learning-method_code/blob/master/PLSA/PLSA.py"
click node_lda "https://github.com/dod-o/statistical-learning-method_code/blob/master/LDA/LDA.py"
click node_pagerank "https://github.com/dod-o/statistical-learning-method_code/blob/master/Page_Rank/Page_Rank.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_perceptron,node_knn,node_naivebayes,node_decisiontree,node_logistic,node_maxentropy,node_svm,node_adaboost toneBlue
class node_em,node_hmm toneAmber
class node_kmeans,node_hierarchical,node_pca,node_lsa,node_plsa,node_lda toneMint
class node_pagerank toneRose
class node_learner toneIndigo
```

## Components

### Supervised learning

- [Perceptron](https://github.com/dod-o/statistical-learning-method_code/blob/master/perceptron/perceptron_dichotomy.py): `perceptron/perceptron_dichotomy.py`
- [K-nearest neighbors](https://github.com/dod-o/statistical-learning-method_code/blob/master/KNN/KNN.py): `KNN/KNN.py`
- [Naive Bayes](https://github.com/dod-o/statistical-learning-method_code/blob/master/NaiveBayes/NaiveBayes.py): `NaiveBayes/NaiveBayes.py`
- [Decision tree](https://github.com/dod-o/statistical-learning-method_code/blob/master/DecisionTree/DecisionTree.py): `DecisionTree/DecisionTree.py`
- [Logistic regression](https://github.com/dod-o/statistical-learning-method_code/blob/master/Logistic_and_maximum_entropy_models/logisticRegression.py): `Logistic_and_maximum_entropy_models/logisticRegression.py`
- [Maximum entropy](https://github.com/dod-o/statistical-learning-method_code/blob/master/Logistic_and_maximum_entropy_models/maxEntropy.py): `Logistic_and_maximum_entropy_models/maxEntropy.py`
- [Support vector machine](https://github.com/dod-o/statistical-learning-method_code/blob/master/SVM/SVM.py): `SVM/SVM.py`
- [AdaBoost](https://github.com/dod-o/statistical-learning-method_code/blob/master/AdaBoost/AdaBoost.py): `AdaBoost/AdaBoost.py`

### Probabilistic models

- [EM algorithm](https://github.com/dod-o/statistical-learning-method_code/blob/master/EM/EM.py): `EM/EM.py`
- [Hidden Markov model](https://github.com/dod-o/statistical-learning-method_code/blob/master/HMM/HMM.py): `HMM/HMM.py`

### Unsupervised learning

- [K-means clustering](https://github.com/dod-o/statistical-learning-method_code/blob/master/Clustering/K-means_Clustering/K-means_Clustering.py): `Clustering/K-means_Clustering/K-means_Clustering.py`
- [Hierarchical clustering](https://github.com/dod-o/statistical-learning-method_code/blob/master/Clustering/Hierachical_Clustering/Hierachical_Clustering.py): `Clustering/Hierachical_Clustering/Hierachical_Clustering.py`
- [PCA](https://github.com/dod-o/statistical-learning-method_code/blob/master/PCA/PCA.py): `PCA/PCA.py`
- [Latent semantic analysis](https://github.com/dod-o/statistical-learning-method_code/blob/master/LSA/LSA.py): `LSA/LSA.py`
- [Probabilistic LSA](https://github.com/dod-o/statistical-learning-method_code/blob/master/PLSA/PLSA.py): `PLSA/PLSA.py`
- [Latent Dirichlet allocation](https://github.com/dod-o/statistical-learning-method_code/blob/master/LDA/LDA.py): `LDA/LDA.py`

### Ranking

- [PageRank](https://github.com/dod-o/statistical-learning-method_code/blob/master/Page_Rank/Page_Rank.py): `Page_Rank/Page_Rank.py`

### Other components

- **Learner**

## Connections

- Learner → Perceptron: runs implementation (evidence: `README.md`)
- Learner → K-nearest neighbors: runs implementation (evidence: `README.md`)
- Learner → Naive Bayes: runs implementation (evidence: `README.md`)
- Learner → Decision tree: runs implementation (evidence: `README.md`)
- Learner → Logistic regression: runs implementation (evidence: `README.md`)
- Learner → Maximum entropy: runs implementation (evidence: `README.md`)
- Learner → Support vector machine: runs implementation (evidence: `README.md`)
- Learner → AdaBoost: runs implementation (evidence: `README.md`)
- Learner → EM algorithm: runs implementation (evidence: `README.md`)
- Learner → Hidden Markov model: runs implementation (evidence: `README.md`)
- Learner → K-means clustering: runs implementation (evidence: `README.md`)
- Learner → Hierarchical clustering: runs implementation (evidence: `README.md`)
- Learner → PCA: runs implementation (evidence: `README.md`)
- Learner → Latent semantic analysis: runs implementation (evidence: `README.md`)
- Learner → Probabilistic LSA: runs implementation (evidence: `README.md`)
- Learner → Latent Dirichlet allocation: runs implementation (evidence: `README.md`)
- Learner → PageRank: runs implementation (evidence: `README.md`)
