数据挖掘导论第四章ppt课件.ppt
《数据挖掘导论第四章ppt课件.ppt》由会员分享,可在线阅读,更多相关《数据挖掘导论第四章ppt课件.ppt(88页珍藏版)》请在三一办公上搜索。
1、数据挖掘导论,Pang-ning Tan, Michael Stieinbach, and Vipin Kumar著Pearson Education LTD.范明 等译人民邮电出版社,第4章分类:基本概念、决策树与模型评估,引言: 预备知识, 解决分类问题的一般方法 决策树归纳 模型的过分拟合 评估分类器的性能,引言,2022年12月26日星期一,数据挖掘导论,4,分类:定义,Given a collection of records (training set )Each record contains a set of attributes, one of the attributes
2、is the class.Find a model for class attribute as a function of the values of other attributes.Goal: previously unseen records should be assigned a class as accurately as possible.A test set is used to determine the accuracy of the model. Usually, the given data set is divided into training and test
3、sets, with training set used to build the model and test set used to validate it,2022年12月26日星期一,数据挖掘导论,5,分类:解释,2022年12月26日星期一,数据挖掘导论,6,分类任务的例子,肿瘤:Predicting tumor cells as benign or malignant信用卡交易:Classifying credit card transactions as legitimate or fraudulent蛋白质结构:Classifying secondary structures
4、of protein as alpha-helix, beta-sheet, or random coil新闻:Categorizing news stories as finance, weather, entertainment, sports, etc,2022年12月26日星期一,数据挖掘导论,7,分类:技术,Decision Tree based MethodsRule-based MethodsMemory based reasoningNeural NetworksNave Bayes and Bayesian Belief NetworksSupport Vector Mach
5、ines,4.3 决策树归纳,2022年12月26日星期一,数据挖掘导论,9,2022年12月26日星期一,数据挖掘导论,10,决策树: 例子,2022年12月26日星期一,数据挖掘导论,11,决策树,树中包含三种结点 根结点(root node): 没有入边, 有零条或多条出边内部结点(internal node): 恰有一条入边和两条或多条出边叶结点(leaf node)或终端结点(terminal node): 恰有一条入边,但没有出边,2022年12月26日星期一,数据挖掘导论,12,决策树分类任务: 应用模型,2022年12月26日星期一,数据挖掘导论,13,决策树: 使用模型,20
6、22年12月26日星期一,数据挖掘导论,14,决策树: 使用模型,2022年12月26日星期一,数据挖掘导论,15,决策树: 使用模型,2022年12月26日星期一,数据挖掘导论,16,决策树: 使用模型,2022年12月26日星期一,数据挖掘导论,17,决策树: 使用模型,2022年12月26日星期一,数据挖掘导论,18,决策树: 使用模型,2022年12月26日星期一,数据挖掘导论,19,决策树分类任务:学习模型,2022年12月26日星期一,数据挖掘导论,20,决策树归纳,Many Algorithms:Hunts Algorithm (one of the earliest)CARTI
7、D3, C4.5SLIQ, SPRINT,2022年12月26日星期一,数据挖掘导论,21,Hunt算法的一般结构,Let Dt be the set of training records that reach a node tGeneral Procedure:If Dt contains records that belong the same class yt, then t is a leaf node labeled as ytIf Dt is an empty set, then t is a leaf node labeled by the default class, ydI
8、f Dt contains records that belong to more than one class, use an attribute test to split the data into smaller subsets. Recursively apply the procedure to each subset.,2022年12月26日星期一,数据挖掘导论,22,Hunt算法: 例,2022年12月26日星期一,数据挖掘导论,23,决策树归纳,Greedy strategy.Split the records based on an attribute test that
9、optimizes certain criterion.IssuesDetermine how to split the recordsHow to specify the attribute test condition?How to determine the best split?Determine when to stop splittingDiscuss above three issues in details,2022年12月26日星期一,数据挖掘导论,24,如何指定属性测试条件,Depends on attribute typesNominalOrdinalContinuous
10、Depends on number of ways to split2-way splitMulti-way split,2022年12月26日星期一,数据挖掘导论,25,划分: 标称属性,Multi-way split: Use as many partitions as distinct values. Binary split: Divides values into two subsets. Need to find optimal partition from all possible partitions.,2022年12月26日星期一,数据挖掘导论,26,划分: 序数属性,Mul
11、ti-way split: Use as many partitions as distinct values. Binary split: Divides values into two subsets. Need to find optimal partition from all possible partitions.What about this split?,2022年12月26日星期一,数据挖掘导论,27,划分: 连续属性,Different ways of handlingDiscretization to form an ordinal categorical attribu
12、teStatic discretize once at the beginningCan be treated as ordinal attributeDynamic ranges can be found by equal interval bucketing, equal frequency bucketing (percentiles), or clustering.Binary Decision: (A v) or (A v) consider all possible splits and finds the best cut can be more compute intensiv
13、e,2022年12月26日星期一,数据挖掘导论,28,划分: 连续属性(续),2022年12月26日星期一,数据挖掘导论,29,如何确定最佳划分,Before Splitting: 10 records of class 0, 10 records of class 1,Which test condition is the best?,Own,Car?,C0: 6,C1: 4,C0: 4,C1: 6,C0: 1,C1: 3,C0: 8,C1: 0,C0: 1,C1: 7,Car,Type?,Yes,No,Family,Sports,Luxury,2022年12月26日星期一,数据挖掘导论,3
14、0,如何确定最佳划分(续),Greedy approach: Nodes with homogeneous class distribution are preferredNeed a measure of node impurity,2022年12月26日星期一,数据挖掘导论,31,结点的不纯度,结点的不纯度设有c个类, t是结点, p(i|t)表示给定结点t中属于类i的记录所占的比例 Entropy Gini IndexMisclassification error,2022年12月26日星期一,数据挖掘导论,32,标准比较,不同的不纯性度量是一致的 对于二类问题,2022年12月26日星
15、期一,数据挖掘导论,33,划分的增益,划分的增益设结点parent上有N个记录设结点parent被划分成k部分, 即parent有k个子女v1,vk设I(vj)是结点vj的不纯度, 则划分的增益为其中, N(vj)是结点vj的记录数, I(.)可以是entropy(.), Gini(.), error(.)等 反映结点parent划分为v1,vk后不纯度的降低越大,越有利于分类信息增益(information gain)当不纯度用entropy度量时,称为信息增益info(Gain),2022年12月26日星期一,数据挖掘导论,34,如何确定最佳划分(续),基本思想如果采用二元划分, 则对非二
16、元属性确定最佳划分对于分类和序数属性, 需要考虑所有可能对于连续属性, 如果不离散化, 需要采用二元划分如何确定最佳划分点, 见后面的例子属性最佳划分是不纯度最低的划分对每个属性的最佳划分, 计算划分增益结点的最佳划分是划分增益最大的属性(最佳)划分,2022年12月26日星期一,数据挖掘导论,35,连续属性的最佳划分点,确定最佳划分点把属性值由小到大排序v(1) v(2) v(k)(取相邻值的中点为划分点:如果v(i) v(i+1), 则取(v(i) + v(i+1)/2为划分点评估每个划分点,选取不纯度最低的划分,2022年12月26日星期一,数据挖掘导论,36,连续属性的最佳划分点(续)
17、,确定连续属性的最佳划分点的计算开销可能很大需要计算k1个可能的划分点产生的划分的不纯度减少待考察的划分点方法如果v(i) v(i+1), 但是v(i)和v(i+1),是同类元组的取值, 则最佳划分点一定不在v(i)和v(i+1)之间.,2022年12月26日星期一,数据挖掘导论,37,增益率,熵和Gini指标等不纯性度量往往有利于具有大量不同值的属性 一个极端的例子: 顾客ID(如身份证号)导致最纯的划分,但无助于分类解决方案使用二元划分使用增益率,2022年12月26日星期一,数据挖掘导论,38,增益率(续),增益率是划分增益与划分信息的比GainRatio=/SplitInfo其中划分信
18、息SplitInfo划分信息又称划分的熵用来克服信息增益的缺点C4.5采用增益率,2022年12月26日星期一,数据挖掘导论,39,停止条件,Stop expanding a node when all the records belong to the same classStop expanding a node when all the records have similar attribute valuesStop expanding a node when there is no attribute availableEarly termination (to be discuss
19、ed later),2022年12月26日星期一,数据挖掘导论,40,其他问题:缺失属性值,如何让处理缺失属性值Missing values affect decision tree construction in three different ways:Affects how impurity measures are computedAffects how to distribute instance with missing value to child nodesAffects how a test instance with missing value is classified,
20、2022年12月26日星期一,数据挖掘导论,41,缺失属性值: 计算不纯度量,2022年12月26日星期一,数据挖掘导论,42,缺失属性值:实例分布,Probability that Refund=Yes is 3/9Probability that Refund=No is 6/9Assign record to the left child with weight = 3/9 and to the right child with weight = 6/9,2022年12月26日星期一,数据挖掘导论,43,缺失属性值:实例分类,New record:,Probability that Ma
21、rital Status = Married is 3.67/6.67Probability that Marital Status =Single,Divorced is 3/6.67,4.3 决策树归纳,2022年12月26日星期一,数据挖掘导论,45,决策树归纳算法,createdNode()为决策树建立新结点决策树的结点或者是一个测试条件, 记作node.test_cond; 或者是一个类标号, 记作node.labe find_best_split()确定应当选择哪个属性作为划分训练记录的测试条件计算 或GainRatioClassify(t)为叶结点t确定类标号 TreeGrowt
22、h(E, F)E: 当前数据集, F:当前属性集,2022年12月26日星期一,数据挖掘导论,46,决策树归纳算法(续),算法4.1 决策树归纳算法的框架TreeGrowth(E, F) 1:if stopping_cond(E, F) = true then 2: leaf = createNode() 3: leaf.label = Classify(E) 4: return leaf 5:else 6: root = createNode() 7: root.test_cond = find_best_split(E, F) 8: 令V = v | v是root.test_cond的一个
23、可能的输出 9: for 每个vV do10: Ev = e | root.test_cond (e) = v 并且e E11: child = TreeGrowth(Ev, F)12: 将child作为root的派生结点添加到树中, 并将边(root child)标记为v13: end for14:end if15:return root,2022年12月26日星期一,数据挖掘导论,47,决策树:例,Web Robot/Crawler Detection建立分类模型, 区分人类用户与Web机器人有Web服务器日志导出Web会话记录Web会话记录包含12个属性(见下页)数据集包含2916个记录
24、Web机器人(类1)和人类用户(类2)会话的个数相等10%的数据用于训练90%的数据用于检验,2022年12月26日星期一,数据挖掘导论,48,决策树:例(续),由Web服务器日志 导出的Web会话记录,2022年12月26日星期一,数据挖掘导论,49,决策树:例(续),决策树,2022年12月26日星期一,数据挖掘导论,50,决策树:例(续),从以下4个方面区分出Web机器人和人类用户:Web机器人的访问倾向于宽而浅,而人类用户访问比较集中(窄而深)与人类用户不同,Web机器人很少访问与Web文档相关的图片页Web机器人的会话的长度趋于较长,包含了大量请求页面Web机器人更可能对相同的文档发
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据 挖掘 导论 第四 ppt 课件
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-1921810.html