• Stars
    star
    1,153
  • Rank 40,455 (Top 0.8 %)
  • Language
    Python
  • Created over 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implement Statistical Learning Methods, Li Hang the hard way. 李航《统计学习方法》一书的硬核 Python 实现

Statistical-Learning-Methods(中文文档请往下翻)

Implement all the algorithms introduced by Statistical Learning Methods, Li Hang.

Feature

  • Complete. All the algorithms introduced by this book are implemented, including
    • kNN powered by kd-tree.
    • max entropy model. I cannot find any other repo that implements this algorithm.
    • linear chain conditional random field. I cannot find this model in any other similar repo.
    • HMM powered by baum-welch. Most repos only provide with HMM trained by counting.
  • Detailed. All the algorithms are implemented thoroughly. I try my best not to skip any detail. For example,
    • about how to select the best one of trimmed CART by cross-validation, I asked Dr. Li Hang by e-mail and got detailed answer. Thanks a lot to Dr. Li Hang for his patiance and kindness.
  • Matrix calculation. Strip off for loops. Implement most of the algorithms with matrix calculation supported by numpy.
  • Extensible. It is easy to fit the codes with new datasets because all the algorithms are controllable through parameters, to a large extent.
  • Examples Each algorithm comes with some examples. Just run the model file and you will see the examples. If you have better examples for others to understand the model, please feel free to start a PR.

Dependencies

  • Python3
  • numpy
  • matplotlib
  • rich

Usage

Just run any single file located in each chapter. You will see examples of the algorithm.


统计学习方法

李航博士《统计学习方法》一书的硬核 Python 实现。

项目特色

GitHub 上有许多实现《统计学习方法》的仓库。本仓库与它们的不同之处在于:

  • 完整性。实现了所有模型。包括
    • KD 树支持的 KNN 模型。
    • 最大熵模型。我没有找到其他任何一个仓库实现了该算法。
    • 线性链条件随机场。我同样没有找到其他任何一个仓库实现了该算法。这个模型花费了我一个月的时间去理解和实现。
    • Baum-Welch 算法支持的 HMM 算法。大多数仓库实现的 HMM 算法都是简单的计数模型。
  • 细节。所有的算法我都在尽力完全实现。比如说
    • 有关如何用交叉验证法选取剪枝的 CART 树,我特意邮件询问了李航博士并得到了耐心的解答。在此非常感谢李航博士的支持!
  • 矩阵运算。我不喜欢用循环。你可以看到本仓库中的算法使用了大量的矩阵运算来避免使用循环。
  • 可扩展性。其他仓库的算法可能会在可扩展性上偷懒。比如 GMM 模型可能只实现了两个聚类的简单版本用于演示。而本仓库中的算法尽量将所有可调节部分作为模型参数,以供自由修改使用。
  • 示例。每个算法都加上了我认为会增强读者对算法理解的例子。当然我认为这部分目前还是不太完善的。如果你对如何举例有更好的见解,欢迎给我提 PR。

项目依赖

  • Python3
  • numpy
  • matplotlib
  • rich

如何使用

直接使用 Python 运行任意一个文件夹内的模型文件,你就可以看到算法示例了。

目录

More Repositories

1

fuzzy-fs

a File System Navigator powered by fzf
Shell
28
star
2

leetcode-python-in-one-line

I want to solve Leetcode questions in one line with python
Python
26
star
3

leetcode-racket

Solve leetcode problems by racket.
Racket
23
star
4

rime-zrm

rime输入法的自然码方案(带辅助码及各种词库)
19
star
5

DAML

Original Implementation of Improving Domain-Adapted Sentiment Classification by Deep Adversarial Mutual Learning publicized in AAAI-2020
Python
18
star
6

Paletteau

Global command palette for Windows
C#
16
star
7

dragon-win

Drag and drop files from CLI, like dragon, but for windows
C#
15
star
8

moyu

打工人,工作再累,一定不要忘记摸鱼哦!
Python
14
star
9

polybar-netease-cloud-music

Polybar module for netease-cloud-music
Python
10
star
10

CSAPP-lab

I am reading CSAPP and doing the lab
Assembly
9
star
11

dropdown-remote

Manipulate dropdown terminals (yakuake, guake) in Emacs
Emacs Lisp
8
star
12

Shengsi-ticket

嵊泗船票的抢票脚本
Python
7
star
13

polybar-i3-workspace-windows

A polybar module which shows all windows in the current i3 workspace
Python
7
star
14

zle-fzf

Insert commands, file names and variable names fuzzily through fzf.
Shell
6
star
15

Python-Balanced-Trees

Balanced trees (B tree, red-black tree, splay) implemented in Python
Python
4
star
16

zsh-confer

A zsh plugin which tries to find configuration files automatically.
Shell
3
star
17

zsh-tmux-or-ssh

Start a tmux session, or a ssh session, to make me work neatly
Shell
3
star
18

polybar-wunderlist

Wunderlist module for polybar.
Shell
3
star
19

WindowDirector

An Autohotkey script for moving to window in the given direction.
AutoHotkey
3
star
20

vi-mode

Shell
2
star
21

MachineLearningStudy

Python
1
star
22

SleepyBag

1
star
23

TrivialPractice

Python
1
star