{"id":13688069,"url":"https://github.com/wzyonggege/statistical-learning-method","last_synced_at":"2026-10-19T09:05:12.168Z","repository":{"id":43512592,"uuid":"115580416","full_name":"wzyonggege/statistical-learning-method","owner":"wzyonggege","description":"《统计学习方法》笔记-基于Python算法实现","archived":false,"fork":false,"pushed_at":"2026-08-12T06:10:49.000Z","size":749,"stargazers_count":2176,"open_issues_count":5,"forks_count":664,"subscribers_count":71,"default_branch":"master","last_synced_at":"2026-08-12T08:43:31.675Z","etag":null,"topics":["python","statistical-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wzyonggege.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-28T03:21:08.000Z","updated_at":"2026-08-12T07:47:08.000Z","dependencies_parsed_at":"2022-08-12T10:41:44.346Z","dependency_job_id":null,"html_url":"https://github.com/wzyonggege/statistical-learning-method","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wzyonggege/statistical-learning-method","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzyonggege%2Fstatistical-learning-method","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzyonggege%2Fstatistical-learning-method/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzyonggege%2Fstatistical-learning-method/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzyonggege%2Fstatistical-learning-method/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wzyonggege","download_url":"https://codeload.github.com/wzyonggege/statistical-learning-method/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wzyonggege%2Fstatistical-learning-method/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344872684,"owners_count":38352877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-19T02:00:06.414Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","statistical-learning"],"created_at":"2024-08-02T15:01:06.060Z","updated_at":"2026-10-19T09:05:12.162Z","avatar_url":"https://github.com/wzyonggege.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# Statistical Learning Method\n\n\u003e 《统计学习方法》笔记——基于 Python 算法实现\n\nThis repository is an educational companion to classic statistical-learning\nmethods. It explains the mathematics, implements the main ideas by hand in\nPython, and uses scikit-learn only for comparison cells that were part of the\noriginal notebooks.\n\nThe 2026 revival keeps that original purpose intact: the notebooks are learning\nmaterial first, and a modern runtime is a way to make that material usable\nagain—not a reason to replace the implementations with library calls.\n\n## Project history and scope\n\nThe project was created on 28 December 2017 and its original development\nseries ended on 9 January 2018. The original Chinese notes, examples, plots,\nand chapter order are preserved while the maintenance work adds reproducible\nsetup, validation, and small compatibility fixes in separate pull requests.\n\n## Nine chapters\n\n| Chapter | Topic | Notebook |\n| --- | --- | --- |\n| 1 | 最小二乘法 / Least squares | [least_sqaure_method.ipynb](LeastSquaresMethod/least_sqaure_method.ipynb) |\n| 2 | 感知机 / Perceptron | [Iris_perceptron.ipynb](Perceptron/Iris_perceptron.ipynb) |\n| 3 | k 近邻法 / k-nearest neighbors | [KNN.ipynb](KNearestNeighbors/KNN.ipynb) |\n| 4 | 朴素贝叶斯 / Naive Bayes | [GaussianNB.ipynb](NaiveBayes/GaussianNB.ipynb) |\n| 5 | 决策树 / Decision tree | [DT.ipynb](DecisonTree/DT.ipynb) |\n| 6 | 逻辑斯谛回归 / Logistic regression | [LR.ipynb](LogisticRegression/LR.ipynb) |\n| 7 | 支持向量机 / SVM | [support-vector-machine.ipynb](SVM/support-vector-machine.ipynb) |\n| 8 | AdaBoost | [Adaboost.ipynb](AdaBoost/Adaboost.ipynb) |\n| 9 | EM 算法 / Expectation-Maximization | [em.ipynb](EM/em.ipynb) |\n\n## Quick start\n\nThe supported development range is Python 3.10–3.13. [uv](https://docs.astral.sh/uv/)\ncreates the environment from the committed lock file:\n\n```bash\nuv sync --all-groups\nuv run python -m pytest\nuv run python scripts/validate_notebooks.py\nuv run python scripts/execute_notebooks.py\n```\n\nThe last command executes all nine notebooks that are currently compatible\nwith modern dependencies. The validator independently checks every committed\nnotebook for notebook-format and stored-error problems.\nOpen the notebooks in JupyterLab with:\n\n```bash\nuv run jupyter lab\n```\n\nThe decision-tree notebook's final visualization renders when the system\nGraphviz `dot` executable is available. Without it, the notebook completes\nand reports the optional rendering dependency while retaining the DOT source.\nThe Python `graphviz` package is included in the environment; install the\nexecutable with your platform's package manager when you want the image.\n\n## 2026 maintenance status\n\n**Branch:** `master` after the 2026 revival promotion\u003cbr\u003e\n**Current stage:** maintenance stack promoted; `v2026.1.0` release tag pending\u003cbr\u003e\n**Original upstream baseline:** last commit 9 January 2018; no published release\n\n### Compatibility audit snapshot\n\nThe following snapshot was collected on 12 August 2026 in a clean CPython\n3.13.13 virtual environment using the latest versions resolved for this audit.\nThe committed `uv.lock` is the reproducibility source; this table records what\nwas actually exercised during the baseline audit.\n\n| Component | Audit version |\n| --- | --- |\n| Python | 3.13.13 |\n| NumPy | 2.5.2 |\n| pandas | 3.0.5 |\n| matplotlib | 3.11.1 |\n| scikit-learn | 1.9.0 |\n\n| Notebook | Baseline result | Finding / follow-up |\n| --- | --- | --- |\n| Least squares | Pass | Smoke-tested; preserve the curve-fitting explanation and outputs. PR 2. |\n| Perceptron | Pass | Hand-written SGD module, current sklearn comparison, and classifier tests added in PR 4. |\n| k-nearest neighbors | Pass | Hand-written distance/voting module, deterministic split, and correctness tests added in PR 5. |\n| Naive Bayes | Pass | Hand-written Gaussian module, 2-D sklearn single-sample comparison, and tests added in PR 6. |\n| Decision tree | Pass | Hand-written ID3 module/tests added; Graphviz rendering is optional when `dot` is unavailable. PR 7. |\n| Logistic regression | Pass | Hand-written stochastic-gradient implementation extracted and tested; NumPy-safe sigmoid and deterministic split added in PR 8. |\n| SVM | Pass | `model_selection.train_test_split` migration complete; hand-written SMO module and tests added in PR 3. |\n| AdaBoost | Pass | Hand-written threshold weak learners now handle perfect, constant, and coarse-step features; reproducible 100-run experiment added in PR 9. |\n| EM | Pass | Generator-based Bernoulli-mixture implementation now captures fit data instead of reading global state; correctness tests added in PR 10. |\n\nThe baseline notebook metadata still identifies Python 3.6.1. That metadata is\nhistorical, not a supported runtime declaration. No notebook implementation\nbehavior is changed in PR 1.\n\n### CI policy\n\nGitHub Actions validates all nine primary notebooks as nbformat 4 documents and\nexecutes all nine current smoke notebooks on Python 3.10, 3.11, 3.12, and\n3.13. The matrix does not hide notebook failures behind\n`allow_errors`; compatibility notes remain in the table above.\n\n### Planned pull-request sequence\n\n1. **PR 1 — Foundation:** MIT license, ignore rules,\n   checkpoint cleanup, locked dependencies, notebook validation/smoke CI,\n   README, and contribution guidance.\n2. **PR 2 — Least squares:** modern execution boundaries and lightweight\n   numerical correctness tests.\n3. **PR 3 — SVM:** migrate deprecated imports, preserve the hand-written SMO\n   explanation, and add kernel/classification checks.\n4. **PR 4 — Perceptron:** current sklearn comparison API and hand-written\n   classifier tests.\n5. **PR 5 — k-nearest neighbors:** input validation, deterministic examples,\n   and distance/prediction tests.\n6. **PR 6 — Naive Bayes:** modern single-sample comparison shape and tests for\n   Gaussian probability/classification behavior.\n7. **PR 7 — Decision tree:** preserve the entropy/information-gain implementation,\n   make the visualization path portable, and test tree predictions.\n8. **PR 8 — Logistic regression:** preserve gradient descent while making\n   scalar/array behavior explicit and testing convergence on the teaching data.\n9. **PR 9 — AdaBoost:** retain the threshold weak learners, address runtime and\n   edge cases, and test weight updates/classification.\n10. **PR 10 — EM:** preserve the generator-based teaching flow and add\n    parameter/convergence tests.\n11. **PR 11 — Release readiness:** [CHANGELOG.md](CHANGELOG.md), the [2026\n   revival release plan](docs/2026-revival-release-plan.md), final\n   compatibility matrix, and [issue/PR triage record](docs/issue-triage-2026.md).\n\nAt the initial audit time GitHub Issues were disabled and the repository\nreported zero pull requests, so there was no existing issue or PR backlog to\nmerge into this plan. The scoped Draft PR chain above is now the public record\nof this revival work.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow, notebook\npreservation rules, validation commands, and pull-request boundaries.\n\n## License\n\nThis project is released under the [MIT License](LICENSE), copyright\n`wzyonggege`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwzyonggege%2Fstatistical-learning-method","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwzyonggege%2Fstatistical-learning-method","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwzyonggege%2Fstatistical-learning-method/lists"}