决策树简单描述

决策树的样子大概是这个样子的:

选择一个特征作为根节点,把这个特征划分成两个孩子节点,每个孩子节点就是原始数据集的子集,然后再找一个特征作为划分……


划分的好坏,如图所示:

用纯度Purity来衡量划分的效果,如果划分的好,那么每一个子集都是某一类占据大多数,如果每一个子集都是跟父节点一样的状态,那么就是Low purity。

一个好的划分要满足下面两个特点:

  1. 划分是High purity
  2. 划分产生的两个子节点的样本数量相近,避免产生非常小的子集。

决策树的终止条件:

  1. 树的深度到达一定条件;
  2. 每一个节点中的样本数量到达一个下线
  3. 不会再有划分,可以增加节点的purity了

衡量purity的三种方法

有不同的衡量purity的方法,不同的衡量方法会导致不同的分裂。

Gini Coefficient

  • Pr(k)是一个样本属于类别K的概率;
  • C就是类别的总数

GINI系数的计算方法:


Entropy熵



可以看出来,GINI系数是类别的概率乘上类别的概率,而熵是类别的概率呈上类别概率的logarithm

  • GINI的取值范围是0.5~1,越大越purity;
  • Entropy的取值范围是0~1,越小越purity

    介绍完了熵,那么什么是信息增益:

    是要最大化的信息增益:



    因为Entropy取值范围是0就purity,所以information gain越大,那么说明分割的purity越好。

看一下Entropy的计算方法:

决策树purity/基尼系数/信息增益 Decision Trees的更多相关文章

  1. 海量数据挖掘MMDS week6: 决策树Decision Trees

    http://blog.csdn.net/pipisorry/article/details/49445465 海量数据挖掘Mining Massive Datasets(MMDs) -Jure Le ...

  2. Decision Trees 决策树

    Decision Trees (DT)是用于分类和回归的非参数监督学习方法. 目标是创建一个模型,通过学习从数据特征推断出的简单决策规则来预测目标变量的值. 例如,在下面的例子中,决策树从数据中学习用 ...

  3. Facebook Gradient boosting 梯度提升 separate the positive and negative labeled points using a single line 梯度提升决策树 Gradient Boosted Decision Trees (GBDT)

    https://www.quora.com/Why-do-people-use-gradient-boosted-decision-trees-to-do-feature-transform Why ...

  4. CatBoost使用GPU实现决策树的快速梯度提升CatBoost Enables Fast Gradient Boosting on Decision Trees Using GPUs

    python机器学习-乳腺癌细胞挖掘(博主亲自录制视频)https://study.163.com/course/introduction.htm?courseId=1005269003&ut ...

  5. Logistic Regression vs Decision Trees vs SVM: Part II

    This is the 2nd part of the series. Read the first part here: Logistic Regression Vs Decision Trees ...

  6. Logistic Regression Vs Decision Trees Vs SVM: Part I

    Classification is one of the major problems that we solve while working on standard business problem ...

  7. Machine Learning Methods: Decision trees and forests

    Machine Learning Methods: Decision trees and forests This post contains our crib notes on the basics ...

  8. 壁虎书6 Decision Trees

    Decision Trees are versatile Machine Learning algorithms that can perform both classification and re ...

  9. 机器学习算法 --- Pruning (decision trees) & Random Forest Algorithm

    一.Table for Content 在之前的文章中我们介绍了Decision Trees Agorithms,然而这个学习算法有一个很大的弊端,就是很容易出现Overfitting,为了解决此问题 ...

随机推荐

  1. BigDecimal 01 - 在JAVA中怎么比较Double类型数据的大小?

    2019独角兽企业重金招聘Python工程师标准>>>  非整型数,运算由于精度问题,可能会有误差,建议使用BigDecimal类型! double a = 0.001;  doub ...

  2. 【kafka KSQL】游戏日志统计分析(1)

    [kafka KSQL]游戏日志统计分析(1) 以游戏结算日志为例,展示利用KSQL对日志进行统计分析的过程. 启动confluent cd ~/Documents/install/confluent ...

  3. Nginx SSL/HTTPS 配置

    使用OpenSSL生成证书 1.生成RSA密钥的方法 openssl genrsa -des3 -out privkey.pem 2048 这个命令会生成一个2048位的密钥,同时有一个des3方法加 ...

  4. Codeforce 239 B. Easy Tape Programming

    There is a programming language in which every program is a non-empty sequence of "<" a ...

  5. 蓝色展开收缩悬浮QQ客服代码

    放在我的博客首页上的的预览图: 在文章区的预览图如下: 代码如下: <div class="scrollsidebar" id="scrollsidebar&quo ...

  6. redis系列之1----redis简介以及linux上的安装

    redis简介 redis是NoSQL(No Only SQL,非关系型数据库)的一种,NoSQL是以Key-Value的形式存储数据.当前主流的分布式缓存技术有redis,memcached,ssd ...

  7. Spring Boot 整合Web 层技术(整合Servlet)

    1 整合Servlet 方式一1.1通过注解扫描完成Servlet 组件的注册      1.1.1创建Servlet /*** 整合Servlet 方式一*/@WebServlet(name = & ...

  8. HTTP GET | POST | DELETE请求

    依赖: <dependency> <groupId>com.squareup.okhttp3</groupId> <artifactId>okhttp& ...

  9. 简单谈谈Spring的IoC

    一.前言   这几天正在复习Spring的相关内容,同时想要对Spring的实现原理做一些深入的研究.今天看了看Spring中IoC的实现,找到了一篇非常详细的博客,研究了一个下午,看完之后唯一的感受 ...

  10. 【Scala】isInstanceOf 与 classOf的对比,代码+注解简洁明了

    class Animal { } class Cat extends Animal { } object Cat { def main(args: Array[String]): Unit = { / ...