分类基本概念决策树与模型评估精要.ppt
文本预览下载声明
处理决策树中的过分拟合… 后剪枝 在该方法中,初始决策树按照最大规模生长,然后进行剪枝的步骤,按照自底向上的方式修剪完全增长的决策树。 修剪有两种做法: 用新的叶结点替换子树,该叶结点的类标号由子树下记录中的多数类确定 用子树中最常用的分支代替子树 处理决策树中的过分拟合… 与先剪枝相比,后剪枝技术倾向于产生更好的结果。 因为不像先剪枝,后剪枝是根据完全增长的决策树作出的剪枝决策,先剪枝则可能过早终止决策树的生长。 然而,对于后剪枝,当子树被剪掉后,生长完全决策树的额外开销就被浪费了。 不平衡类问题 PREDICTED CLASS ACTUALCLASS Class=Yes Class=No Class=Yes a(TP) b(FN) Class=No c(FP) d(TN) 准确率的缺点 考虑2类问题 类0的样本数 = 9990 类1的样本数 = 10 如果模型预测所有的样本为类0, 准确率为 9990/10000 = 99.9 % 准确率的值具有欺骗性 模型并没有分对类1的任何样本 度量 精度确定在分类器断言为正类的那部分记录中实际为正类的记录所占的比例。精度越高,分类器的假正类错误率就越低。 召回率度量被分类器正确预测的正样本的比例。具有高召回率的分类器很少将正样本误分为负样本。 ROC (Receiver Operating Characteristic) ROC曲线是显示分类器真正率(TPR)和假正率(FPR)之间折中的一种图形化方法。 ROC 曲线上有几个关键点,它们有公认的解释: (TPR=0,FPR=0):把每个实例都预测为负类的模型 (TPR=1,FPR=1):把每个实例都预测为正类的模型 (TPR=1,FPR=0):理想模型 使用ROC曲线比较模型 没有哪个模型能够压倒对方 FRR0.36,M1 较好 FRR0.36, M2较好 ROC曲线下方的面积 理想情况: 面积= 1 随机猜测: 面积 = 0.5 怎样产生ROC曲线 Threshold = ROC 曲线: Example of Bayes Theorem Given: A doctor knows that meningitis causes stiff neck 50% of the time Prior probability of any patient having meningitis is 1/50,000 Prior probability of any patient having stiff neck is 1/20 If a patient has stiff neck, what’s the probability he/she has meningitis? Bayesian Classifiers Consider each attribute and class label as random variables Given a record with attributes (A1, A2,…,An) Goal is to predict class C Specifically, we want to find the value of C that maximizes P(C| A1, A2,…,An ) Can we estimate P(C| A1, A2,…,An ) directly from data? Bayesian Classifiers Approach: compute the posterior probability P(C | A1, A2, …, An) for all values of C using the Bayes theorem Choose value of C that maximizes P(C | A1, A2, …, An) Equivalent to choosing value of C that maximizes P(A1, A2, …, An|C) P(C) How to estimate P(A1, A2, …, An | C )? Na?ve Bayes Classifier Assume independence among attributes Ai when class is given: P(A1, A2, …, An | Cj ) = P(A1| Cj) P(A2| Cj)… P(An| Cj) Can estimate P(Ai| Cj) for all Ai and Cj. New point is classified to
显示全部