All Projects → fuqiuai → Lihang_algorithms

fuqiuai / Lihang_algorithms

用python和sklearn两种方法实现李航《统计学习方法》中的算法

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Lihang algorithms

Data mining
The Ruby DataMining Gem, is a little collection of several Data-Mining-Algorithms
Stars: ✭ 10 (-96.2%)
Mutual labels:  data-mining, machine-learning-algorithms
Pyss3
A Python package implementing a new machine learning model for text classification with visualization tools for Explainable AI
Stars: ✭ 191 (-27.38%)
Mutual labels:  data-mining, machine-learning-algorithms
Php Ml
PHP-ML - Machine Learning library for PHP
Stars: ✭ 7,900 (+2903.8%)
Mutual labels:  data-mining, machine-learning-algorithms
Machine Learning Books
book
Stars: ✭ 290 (+10.27%)
Mutual labels:  data-mining, machine-learning-algorithms
xgboost-smote-detect-fraud
Can we predict accurately on the skewed data? What are the sampling techniques that can be used. Which models/techniques can be used in this scenario? Find the answers in this code pattern!
Stars: ✭ 59 (-77.57%)
Mutual labels:  data-mining, machine-learning-algorithms
Model Describer
model-describer : Making machine learning interpretable to humans
Stars: ✭ 22 (-91.63%)
Mutual labels:  data-mining, machine-learning-algorithms
Python Machine Learning Book
The "Python Machine Learning (1st edition)" book code repository and info resource
Stars: ✭ 11,428 (+4245.25%)
Mutual labels:  data-mining, machine-learning-algorithms
Spring2017 proffosterprovost
Introduction to Data Science
Stars: ✭ 18 (-93.16%)
Mutual labels:  data-mining, machine-learning-algorithms
Heart disease prediction
Heart Disease prediction using 5 algorithms
Stars: ✭ 43 (-83.65%)
Mutual labels:  data-mining, machine-learning-algorithms
PaperWeeklyAI
📚「@MaiweiAI」Studying papers in the fields of computer vision, NLP, and machine learning algorithms every week.
Stars: ✭ 50 (-80.99%)
Mutual labels:  data-mining, machine-learning-algorithms
Papers Literature Ml Dl Rl Ai
Highly cited and useful papers related to machine learning, deep learning, AI, game theory, reinforcement learning
Stars: ✭ 1,341 (+409.89%)
Mutual labels:  data-mining, machine-learning-algorithms
genie
Genie: A Fast and Robust Hierarchical Clustering Algorithm (this R package has now been superseded by genieclust)
Stars: ✭ 21 (-92.02%)
Mutual labels:  data-mining, machine-learning-algorithms
Suod
(MLSys' 21) An Acceleration System for Large-scare Unsupervised Heterogeneous Outlier Detection (Anomaly Detection)
Stars: ✭ 245 (-6.84%)
Mutual labels:  data-mining, machine-learning-algorithms
taller SparkR
Taller SparkR para las Jornadas de Usuarios de R
Stars: ✭ 12 (-95.44%)
Mutual labels:  data-mining, machine-learning-algorithms
genieclust
Genie++ Fast and Robust Hierarchical Clustering with Noise Point Detection - for Python and R
Stars: ✭ 34 (-87.07%)
Mutual labels:  data-mining, machine-learning-algorithms
RL-2018
Reinforcement Learning at UCLA IPAM RIPS 2018
Stars: ✭ 15 (-94.3%)
Mutual labels:  machine-learning-algorithms
MachineLearningSeries
Vídeos e códigos do Universo Discreto ensinando o fundamental de Machine Learning em Python. Para mais detalhes, acompanhar a playlist listada.
Stars: ✭ 20 (-92.4%)
Mutual labels:  machine-learning-algorithms
sdp
Deep nonparametric estimation of discrete conditional distributions via smoothed dyadic partitioning
Stars: ✭ 15 (-94.3%)
Mutual labels:  machine-learning-algorithms
fastML
A Python package built on sklearn for running a series of classification Algorithms in a faster and easier way.
Stars: ✭ 40 (-84.79%)
Mutual labels:  machine-learning-algorithms
Machine Learning And Ai In Trading
Applying Machine Learning and AI Algorithms applied to Trading for better performance and low Std.
Stars: ✭ 258 (-1.9%)
Mutual labels:  machine-learning-algorithms

lihang_algorithms

用python和sklearn实现李航老师的《统计学习方法》中所提到的算法

实验数据:MNIST数据集,这里用kaggle中处理好的数据
官方下载地址:http://yann.lecun.com/exdb/mnist/
kaggle中处理好的数据:https://www.kaggle.com/c/digit-recognizer/data


第二章 感知机

适用问题:二类分类
实验数据:由于是二分类器,所以将MINST数据集train.csv的label列进行了一些微调,label等于0的继续等于0,label大于0改为1。这样就将十分类的数据改为二分类的数据。获取地址train_binary.csv

代码:perceptron/perceptron.py
运行结果:


代码(用sklearn实现):perceptron/perceptron_sklearn.py
运行结果:

第三章 k邻近法

适用问题:多类分类
三个基本要素:k值的选择、距离度量及分类决策规则

代码:knn/knn.py
运行结果:


代码(用sklearn实现):knn/knn_sklearn.py
运行结果:

第四章 朴素贝叶斯法

适用问题:多类分类
基于贝叶斯定理和特征条件独立假设
常用的三个模型有:

  • 高斯模型:处理特征是连续型变量的情况
  • 多项式模型:最常见,要求特征是离散数据
  • 伯努利模型:要求特征是离散的,且为布尔类型,即true和false,或者1和0


代码(基于多项式模型):naive_bayes/naive_bayes.py
运行结果:


代码(基于多项式模型,用sklearn实现):naive_bayes/naive_bayes_sklearn.py
运行结果:

第五章 决策树

适用问题:多类分类
三个步骤:特征选择、决策树的生成和决策树的剪枝
常见的决策树算法有:

  • ID3:特征划分基于信息增益
  • C4.5:特征划分基于信息增益比
  • CART:特征划分基于基尼指数


ID3算法代码:decision_tree/ID3.py
运行结果:


C4.5算法代码:decision_tree/C45.py
运行结果:


CART算法代码(用sklearn实现):decision_tree/decision_tree_sklearn.py
运行结果:

第六章 逻辑斯谛回归

二项逻辑斯谛回归

适用问题:二类分类
可类比于感知机算法
实验数据:train_binary.csv
代码:logistic_regression/logistic_regression.py
运行结果:

(多项)逻辑斯谛回归

适用问题:多类分类
实验数据:train.csv
代码(用sklearn实现):logistic_regression/logistic_regression_sklearn.py
运行结果:

第六章 最大熵模型

适用问题:多类分类
下面用改进的迭代尺度法(IIS)学习最大熵模型,将特征函数定义为:

与其他分类器不同的是,最大熵模型中的f(x,y)中的x是单独的一个特征,不是一个n维特征向量,因此我们需要对每个维度特征加一个区分标签;如X=(x0,x1,x2,...)变为X=(0_x0,1_x1,2_x2,...)

代码:maxEnt/maxEnt.py
运行结果:

第七章 支持向量机

适用问题:二类分类
实验数据:二分类的数据 train_binary.csv
SVM有三种模型,由简至繁为

  • 当训练数据训练可分时,通过硬间隔最大化,可学习到硬间隔支持向量机,又叫线性可分支持向量机
  • 当训练数据训练近似可分时,通过软间隔最大化,可学习到软间隔支持向量机,又叫线性支持向量机
  • 当训练数据训练不可分时,通过软间隔最大化及核技巧(kernel trick),可学习到非线性支持向量机


代码(用sklearn实现):svm/svm_sklearn.py
注:可用拆解法(如OvO,OvR)将svm扩展成适用于多分类问题(其他二分类问题亦可),sklearn中已经实现

运行结果:

第八章 提升方法

提升方法就是组合一系列弱分类器构成一个强分类器,AdaBoost是其代表性算法

AdaBoost算法

适用问题:二类分类,要处理多类分类需进行改进
代码(用sklearn实现):AdaBoost/AdaBoost_sklearn.py

实验数据为train.csv的运行结果:


实验数据为train_binary.csv的运行结果:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].