
机器学习算法
文章平均质量分 93
微电子学与固体电子学-俞驰
如切如磋,如琢如磨,臻于至善。
展开
-
Dr. Bojan Cestnik生平(剪枝算法MEP发明者之一)
Slovenia。原创 2023-06-22 18:53:50 · 1401 阅读 · 0 评论 -
Gram矩阵计算实例
一开始没搞明白具体咋计算,后来经人指点,记录下:matlab代码如下:’ 代表向量的转置x1=[3,3]',x2=[4,3]',x3=[1,1]',G=[x1'*x1,x1'*x2,x1'*x3; x2'*x1,x2'*x2,x2'*x3; x3'*x1,x3'*x2,x3'*x3]得到Gram矩阵如下:G = 18 ...原创 2017-10-07 16:59:46 · 13140 阅读 · 4 评论 -
李航第一章课后习题答案
统计学习方法的三要素是模型、策略、算法。伯努利模型是定义在取值为0与1的随机变量上的概率分布。统计学分为两派:经典统计学派和贝叶斯统计学派。两者的不同主要是,经典统计学派认为模型已定,参数未知,参数是固定的,只是还不知道;贝叶斯统计学派是通过观察到的现象对概率分布中的主观认定不断进行修正。极大似然估计和贝叶斯估计的模型都是伯努利模型也就是条件概率模型;极大似然估计用的是经典统计学派的策略,贝...转载 2018-10-02 19:01:24 · 419 阅读 · 0 评论 -
统计学习方法例2.1实现(转)
对应李航《统计学习方法》P29的例2.1# -*- coding: utf-8 -*-import sysreload(sys)sys.setdefaultencoding('utf-8')# @Author: appleyuchi# @Date: 2018-10-02 21:54:30# @Last Modified by: appleyuchi# @Last Mod...转载 2018-10-02 21:58:03 · 730 阅读 · 0 评论 -
统计学习方法-第二章课后习题答案整理
2.1Minsky和Papert指出:感知机因为是线性模型,所以不能表示复杂的函数,如异或。验证感知机为什么不能表示异或参考链接:https://blog.youkuaiyun.com/yangfeisc/article/details/454860672.2,换下数据即可,具体代码实现参考:https://blog.youkuaiyun.com/appleyuchi/article/details/829...转载 2018-10-02 23:09:20 · 1898 阅读 · 1 评论 -
统计学习方法第四章课后习题(转载+重新排版+自己解读)
4.1 用极大似然估计法推导朴素贝叶斯法中的先验概率估计公式(4.8)和条件概率估计公式(4.9)##################################################首先是(4.8)P(Y=ck)=∑i=1NI(yi=ck)NP({Y=c_k})=\frac{\sum_{i=1}^NI(y_i=c_k)}{N}P(Y=ck)=N∑i=1NI(yi=...转载 2018-10-03 19:19:29 · 882 阅读 · 0 评论 -
ID3决策树中连续值的处理+周志华《機器學習》图4.8和图4.10绘制
转载自https://blog.youkuaiyun.com/Leafage_M/article/details/80137305用一句话总结这篇博客的内容就是:对于当前n条数据,相邻求平均值,得到n-1个分割值,要点如下:①连续数值特征的熵计算就是对上面的n-1个分割值不停尝试,尝试得到最佳分割值,利用分割值两侧的数据来计算条件熵进而最终计算最大熵增益.②如果当前同时存在离散值和连续值特征,那...转载 2018-10-12 14:37:07 · 1726 阅读 · 0 评论 -
周志華《機器學習》圖4.4和图4.9繪制(轉載+增加熵顯示功能)
代碼來自參考鏈接:https://blog.youkuaiyun.com/leafage_m/article/details/79629074本文的貢獻是:①修正參考鏈接中,算法第3種情況中的投票問題的相關代碼,原文代碼函數makeTreeFull有誤,會導致生成图4.4的"虛擬節點"隨機出現好瓜和壞瓜②在原有代碼基礎上增加熵顯示功能----------------------------算法伪代...原创 2018-10-12 15:28:28 · 685 阅读 · 0 评论 -
《统计学习方法》P59决策树绘制-sklearn版本
原始数据集见:https://blog.youkuaiyun.com/ruggier/article/details/78756447这个数据集的意思是:因为银行怕贷款申请者还不起贷款,所以要判断贷款者的各种情况,以便绝对是否对贷款申请者发放贷款。因为使用sklearn需要数字类型的数据,不能是字符串数据,所以下面对原始数据集进行转化。对照关系如下:#年龄:青年:0中年:1老年:2#有工作...原创 2018-10-06 15:40:54 · 484 阅读 · 0 评论 -
sklearn没有实现ID3算法
https://stackoverflow.com/questions/32277562/how-to-set-up-id3-algorith-in-scikit-learnhttp://scikit-learn.org/stable/modules/tree.html#tree-algorithms-id3-c4-5-c5-0-and-cart根据这两个链接可知,其实sklearn的决策树...原创 2018-10-06 20:47:28 · 1691 阅读 · 0 评论 -
ID3的REP(Reduced Error Pruning)剪枝代码详细解释+周志华《机器学习》决策树图4.5、图4.6、图4.7绘制
处理数据对象:离散型数据信息计算方式:熵数据集:西瓜数据集2.0共17条数据训练集(用来建立决策树):西瓜数据集2.0中的第1,2,3,6,7,10,14,15,16,17,4请注意,书上说是10条,其实是上面列出的11条。验证集(用来对决策树剪枝):西瓜数据集2.0中的5,8,9,11,12,13注意书上特指了其中一些数据集,不可自己随意更改建造决策树的数据集,否则出不来书上的效果...原创 2018-10-13 18:42:48 · 3743 阅读 · 16 评论 -
通俗讲清楚为什么使用信息熵增益比而不是信息熵增益?
来举个简单的例子:数据集D(出去玩是标签)A代表属性,A=心情、天气心情 天气 出去玩好 晴朗 玩不好 下雨 不玩不好 刮风 不玩好了 ,现在建立决策树,根节点是啥?第一种方式(信息熵增益):令A=天气总熵S(D)=−13log213−23log223=0.918-\frac{1}{3}log_{2}\frac{1}{3}-\frac{2}{3}l...原创 2018-10-13 21:49:38 · 517 阅读 · 0 评论 -
《统计学习方法》P74勘误
gR(D,A)=g(D,A)H(D)g_R(D,A)=\frac{g(D,A)}{H(D)}gR(D,A)=H(D)g(D,A)改为gR(D,A)=g(D,A)H(A)g_R(D,A)=\frac{g(D,A)}{H(A)}gR(D,A)=H(A)g(D,A)原创 2018-10-22 23:20:26 · 320 阅读 · 0 评论 -
some understanding of《Inferring Decision Trees Using the Minimum Description Length Principle*》
《Inferring Decision Trees Using the Minimum Description Length Principle*》Information And Computation 80, 227-248(1989)I feel difficuly in computing the whole encoding bits of sequence mixed with fe...原创 2018-10-20 20:31:51 · 384 阅读 · 1 评论 -
C4.5最新版本Release8与MDL的关系的详细解读
最近联系了决策树的作者Quinlan教授,搞清了网上对C4.5的一些不够前沿的描述,《Inferring Decision Trees Using the Minimum Description Length Principle*》《Improved Use of Continuous Attributes in C4.5》对这两篇文章做下总结:我们一般希望决策树可以稍微简化点,要不然就太...原创 2018-10-21 15:48:26 · 432 阅读 · 0 评论 -
標準化,歸一化和的概念与适用范围整理
網上講得比較亂有些博客把歸一化和標準化認爲一致,主要是覺得normalization這個詞語翻譯成標準化和歸一化都沒啥問題Min-Max scaling(歸一化),也可以使用normalization,但是谷歌上不推薦,公式是:網上通俗的說法是:用來消除量鋼的影響。這個說法是不準確的,因爲有的特徵顯然需要比重大一些,有的需要比重小一些。這個“消除量鋼影響”的說法其實是默認數據特徵是一...转载 2018-10-31 12:58:31 · 342 阅读 · 0 评论 -
C4.5-Release8中Ross Quinlan对缺失值的处理
Environment:Ubuntu Linux 16.04GNU Make 4.1Built for x86_64-pc-linux-gnuCopyright © 1988-2014 Free Software Foundation, Inc.gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.11)DataSet:cr...原创 2018-10-31 16:16:06 · 548 阅读 · 0 评论 -
History of pruning algorithm development and python implementation(finished)
All the python-implementation for 7 post-pruning Algorithmsare in the following link:https://github.com/appleyuchi/Decision_Tree_PruneTable of Decision Trees:name of treeinventername of arti...原创 2018-11-03 23:22:27 · 4343 阅读 · 6 评论 -
Weka的-3.6.10的C4.5与Quinlan教授的C4.5算法的区别
使用数据集:http://archive.ics.uci.edu/ml/machine-learning-databases/car/weka-3.6.10的结果是:safety = low: unacc (576.0)safety = med| persons = 2.0: unacc (192.0)| persons = 4.0| | buying = vhigh...原创 2018-11-06 17:27:11 · 373 阅读 · 0 评论 -
Earliest PEP Algorithm Principles
PEP:Pessimistic Error Pruning本文分为三部分:第一部分:1986年的PEP剪枝算法原理第二部分:1997年的PEP剪枝算法原理以及与前者的区别-----------------------------第一部分:《Simplifying Decision Trees》-1986作者:J.R. Quinlan该论文的2.3 Pessimistic Pruni...原创 2018-11-06 22:23:26 · 478 阅读 · 0 评论 -
Pessimistic Error Pruning example of C4.5
This example is from 《An Empirical Comparison of Pruning Methodsfor Decision Tree Induction》How to read these node and leaves?For example:node 30:15 are classified as “class1”2 are mis-classifi...原创 2018-11-09 20:34:49 · 581 阅读 · 0 评论 -
U25%(1,16) and U25%(1,168)on《C4.5:programs for machine learning》
when calculatingUCFU_{CF}UCF(e,N)CF: Confidence Level(here is 25%)e:misclassifying counts of current subtree we focus onN:counts of sub-datasets relevant to current subtree who is under judgment ...原创 2018-11-07 23:30:51 · 807 阅读 · 1 评论 -
《C4.5: Programs for Machine Learning》chaper4实验结果重现
使用自带的数据集:实验结果如下:剪枝前:physician fee freeze = n:| adoption of the budget resolution = y: democrat (151.0)| adoption of the budget resolution = u: democrat (1.0)| adoption of the budget resolu...原创 2018-11-05 19:47:27 · 1013 阅读 · 0 评论 -
Pessimistic error pruning illustration with C4.5-python implemention
------------------get the datasets-----------------------------------We use the following datasets:https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.dataTarget:predict the ...原创 2018-11-11 19:00:59 · 1679 阅读 · 2 评论 -
Error Based Pruning剪枝算法、代码实现与举例
EBP(Error Based Pruning):下列算法转载自链接:https://login.sina.com.cn/crossdomain2.php?action=login&entry=blog&r=http%3A%2F%2Fblog.sina.com.cn%2Fs%2Fblog_64ecfc2f0101r3o5.html%3Fsudaref%3Dwww.baidu.c...原创 2018-11-08 16:28:39 · 1452 阅读 · 0 评论 -
C4.5-Release8的代码架构图
代码链接:http://www.rulequest.com/Personal/c4.5r8.tar.gzfile_structure.dotdigraph abc{"c4.5.c";"besttree.c";"build.c";"info.c";"contin.c";"discr.c&原创 2018-11-08 22:12:18 · 396 阅读 · 0 评论 -
Two Examples of Minimum Error Pruning(reprint)
Attention,this article is from the following link with my own notes:http://www.cse.unsw.edu.au/~billw/cs9414/notes/ml/06prop/id3/id3-2.htmlExpected Error PruningApproximate expected error assuming ...原创 2018-11-15 16:04:05 · 431 阅读 · 0 评论 -
MEP(minimum error pruning) principle with python implemention
According to《Estimating Probabilities: A Crucial Task in Machine learning》:Θ=p(C)p(C∣V1)p(C)p(C∣V1V2)p(C∣V1)p(C∣V1V2V3)p(C∣V1V2)⋅⋅⋅⋅①whereΘ=p(C)\frac{p(C|V_1)}{p(C)}\frac{p(C|V_1V_2)}{p(C|V_1)}\fra...原创 2018-11-18 21:48:24 · 675 阅读 · 1 评论 -
机器学习实战的P264中代码对应的公式推导
文章针对以下代码重点研究:xformedItems = dataMat.T * U[:,:4] * Sig4.I 首先是SVD分解的公式:Mm⋅n=Um⋅m⋅Σm⋅n⋅(Vn⋅n)TM_{m·n}=U_{m·m}·Σ_{m·n}·{(V_{n·n})}^{T} Mm⋅n=Um⋅m⋅Σm⋅n⋅(Vn⋅n)T注意Σ在python代码中返回时,是一个向量,矩阵论中是一个对角矩阵。对角...原创 2018-09-30 20:28:14 · 838 阅读 · 15 评论 -
Error in a paper about CVP
Dear Professor Ricco RAKOTOMALALA:the Reference is:<An Empirical Comparison of Selection Measures for Decision-Tree Induction>The following datasets from above referencetry to find what原创 2018-11-21 23:13:45 · 329 阅读 · 0 评论 -
CVP(Critical Value Pruning)illustration with clear principle in details
The following is a contingency table[1]:H0:Xijn=NiNjn2H_0:\frac{X_{ij}}{n}=\frac{N_iN_j}{n^2}H0:nXij=n2NiNjH1:Xijn≠NiNjn2H_1:\frac{X_{ij}}{n}≠\frac{N_iN_j}{n^2}H1:nXij̸=n2NiNjNij=XijN...原创 2018-11-27 22:45:30 · 687 阅读 · 0 评论 -
CVP(Critical value pruning)examples with python implemention
The python implemention for CVP(Critical Value Pruning) is here:https://github.com/appleyuchi/Decision_Tree_PruneThe C4.5 model is transformed from C-model to Python model,details can be referred in...原创 2018-11-30 22:29:08 · 698 阅读 · 0 评论 -
根据子树样本数对cart树剪枝与剪枝前后图形绘制
代码如下:#-*- coding:utf-8 -*-import sysreload(sys)sys.setdefaultencoding('utf-8')import numpy as npimport pandas as pdfrom sklearn.datasets import make_classificationfrom sklearn.ensemble import ...原创 2018-12-01 19:55:13 · 469 阅读 · 0 评论 -
display your decision tree interactively
Environment:Ubuntu Linux 16.041.python sklearn2json.py2.modify the path of structure.json in index.html3.put structure.json and index.html in the same path4,use the following command to start chr...转载 2018-12-05 23:03:16 · 353 阅读 · 0 评论 -
CCP(Cost complexity pruning) on sklearn with python implemention
implemention of CCP is here:https://github.com/appleyuchi/Decision_Tree_Prunebefore pruned,the original T0 can be found in folder “visualization” :after pruned,the best_tree can be found in folder...原创 2018-12-08 21:45:57 · 1858 阅读 · 0 评论 -
李航第六章的BFGS算法
没啥用,在scipy中已经实现了.参考链接如下https://blog.youkuaiyun.com/ACdreamers/article/details/44664941原创 2018-12-19 15:09:11 · 602 阅读 · 3 评论 -
notes from《classification and regression trees》
page 11thR(d)=1N∑n=1NX(d(xn)≠jn)−−−−−−−(1.8)R(d)=\frac{1}{N}\sum_{n=1}^NX(d(x_n)≠j_n)-------(1.8)R(d)=N1n=1∑NX(d(xn)̸=jn)−−−−−−−(1.8)where X(⋅X(·X(⋅)is index function.For large datasets.L1:L_...原创 2018-12-14 10:56:50 · 318 阅读 · 0 评论 -
sklearn with same data produces different cart model
#-*- coding:utf-8 -*-import sysreload(sys)sys.setdefaultencoding('utf-8')from sklearn.datasets import load_irisfrom sklearn.tree import DecisionTreeClassifierimport jsonimport numpy as npimpor...原创 2018-12-06 19:09:30 · 300 阅读 · 0 评论 -
波士顿房价数据集解读
机器学习:波士顿房价数据集波士顿房价数据集(Boston House Price Dataset)(下载地址:http://t.cn/RfHTAgY)使用sklearn.datasets.load_boston即可加载相关数据。该数据集是一个回归问题。每个类的观察值数量是均等的,共有 506 个观察,13 个输入变量和1个输出变量。每条数据包含房屋以及房屋周围的详细信息。其中包含城镇犯罪率,...转载 2018-12-14 10:22:45 · 25577 阅读 · 6 评论 -
举例讲清楚模型树和回归树的区别
根据上面图中的一个例子,我们来分析下,假设A、B两点是曲线上的噪声点。模型树的叶子节点是一个函数。回归树的叶子节点是取一个区间的平均。所以:对于节点A而言,模型树的估计离主曲线更远,此时选择回归树(预测值为蓝色点)更加合适。对于节点B而言,回归树由于取均值,导致B的预测值是蓝色点,离主曲线太远,此时选用模型树更加合适...原创 2018-12-09 21:31:35 · 4204 阅读 · 0 评论