决策树信息熵计算_决策树熵|熵计算

决策树信息熵计算

A decision tree is a very important supervised learning technique. It is basically a classification problem. It is a tree-shaped diagram that is used to represent the course of action. It contains the nodes and leaf nodes. it uses these nodes and leaf nodes to draw the conclusion. Here we are going to talk about the entropy in the decision tree. Let’s have a look at what we are going to learn about the decision tree entropy.

决策树是一种非常重要的监督学习技术。 这基本上是一个分类问题。 它是一个树形图,用于表示操作过程。 它包含节点和叶节点。 它使用这些节点和叶节点来得出结论。 在这里,我们将讨论决策树中的熵。 让我们看一下我们将要学习的有关决策树熵的知识。

  • What is Entropy?

    什么是熵?
  • Importance of entropy.

    熵的重要性。
  • How to calculate entropy?

    如何计算熵?

什么是熵? (What is Entropy?)

So let’s start with the definition of entropy. What is this entropy?

因此,让我们从熵的定义开始。 这是什么熵?

“The entropy of a decision tree measures the purity of the splits.”

“决策树的熵衡量了拆分的纯度。”

Now let us understand the theory of this one-line definition. Let’s suppose that we have some attributes or features. Now between these features, you have to decides that which features you should use as the main node that is a parent node to start splitting your data. So for deciding which features you should use to split your tree we use the concept called entropy.

现在让我们了解这一单行定义的理论。 假设我们有一些属性或功能。 现在,在这些功能之间,您必须确定应使用哪些功能作为开始分裂数据的父节点的主节点。 因此,为了确定应使用哪些功能来分割树,我们使用了称为的概念

熵的重要性 (Importance of Entropy)

  1. It measures the impurity and disorder.

    它测量杂质和无序。
  2. It is very helpful in decision tree to make decisions.

    在决策树中进行决策非常有帮助。
  3. It helps to predict, which node is to split first on the basis of entropy values.

    它有助于根据熵值预测哪个节点首先分裂。

如何计算熵? (How to calculate Entropy?)

Let’s first look at the formulas for calculating Entropy.

首先让我们看一下计算熵的公式。

Here, p is the Probability of positive class and q is the Probability of negative class.

在此,p是肯定类别概率, q是否定类别概率。

Now low let’s understand this formula with the help of an example. consider some features. Let’s say E1, E2, E3 are some features. we need to make a tree using one of the appropriate features as the parent node. let’s suppose that E2 is the parent node and E1, E3 are leaf node. Now when we construct a decision tree by considering E2 as parent node then it will look like as shown below.

现在低点,让我们借助示例来了解此公式。 考虑一些功能。 假设E1,E2,E3是一些功能。 我们需要使用适当的特征之一作为父节点来制作树。 假设E2是父节点,而E1,E3是叶节点。 现在,当我们通过将E2作为父节点来构建决策树时,其外观将如下所示。

Image for post

I have considered the E2 as a parent node which has 5 positive input and 2 negatives input. The E2 has been split into two leaf nodes (step 2). After the spilt, the data has divided in such a way that E1 contains 2 positive and1 negative and E3 contains 3 positive and 1 negative. Now in the next step, the entropy has been calculated for both the leaf E1 and E2 in order to find out that which one is to consider for next split. The node which has higher entropy value will be considered for the next split. The dashed line shows the further splits, meaning that the tree can be split with more leaf nodes.

我已经将E2视为具有5个正输入和2个负输入的父节点。 E2已被拆分为两个叶节点(步骤2)。 进行拆分后,数据以E1包含2个正值和1个负值以及E3包含3个正值和1个负值的方式进行了划分。 现在,在下一步中,已经为叶E1和E2都计算了熵,以找出下一步要考虑的熵。 具有较高熵值的节点将被考虑用于下一个分割。 虚线显示了进一步的拆分,这意味着可以用更多的叶节点拆分树。

N

ñ

NOTE 2: The value of entropy is always between 0 to 1.

注2:熵值始终在0到1之间。

So this was all about with respect to one node only. You should also know that for further splitting we required some more attribute to reach the leaf node. For this, there is a new concept called information gain.

因此,这仅涉及一个节点。 您还应该知道,为了进一步拆分,我们需要更多属性才能到达叶节点。 为此,有一个称为信息增益的新概念

Worst Case:- If you are getting 50% of data as positive and 50% of the data as negative after the splitting, in that case the entropy value will be 1 and that will be considered as the worst case.

最坏的情况:-如果拆分后获得50%的数据为正,而50%的数据为负,则熵值将为1,这将被视为最坏情况。

If you like this post then please drop the comments and also share this post.

如果您喜欢此帖子,请删除评论并分享此帖子。

翻译自: https://medium.com/swlh/decision-tree-entropy-entropy-calculation-7bdd394d4214

决策树信息熵计算

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/388617.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

多亏了这篇文章,我的开发效率远远领先于我的同事

欢迎大家前往腾讯云社区,获取更多腾讯海量技术实践干货哦~ 本文由独木桥先生发表于云社区专栏 介绍 如果您有从Linux服务器上的源代码安装软件的经验,您可能会遇到make实用程序。该工具主要用于自动编译和构建程序。它允许应用程序的作者轻松地布置构建该…

Free SQLSever 2008的书

Introducing SQL Server 2008 http://csna01.libredigital.com/?urss1q2we6这是一本提供自由使用书!我把它翻译,或转送有什么关系!这样的书还是有几本吧,Introducing Linq,Introducting Silverlight,都是啊!嘿嘿。。。…

流式数据分析_流式大数据分析

流式数据分析The recent years have seen a considerable rise in connected devices such as IoT [1] devices, and streaming sensor data. At present there are billions of IoT devices connected to the internet. While you read this article, terabytes and petabytes…

oracle failover 区别,Oracle DG failover 实战

Oracle dataguardfailover实战操作步骤备库:SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH FORCE;SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;SQL> SHUTDOWN IMMEDIATE;SQL> STARTUP;添加临时文件,删除老的临时文…

Jenkins自动化CI CD流水线之8--流水线自动化发布Java项目

一、前提 插件:Maven Integration plugin 环境: maven、tomcat 用的博客系统代码: git clone https://github.com/b3log/solo.git 远端git服务器: [gitgit repos]$ mkdir -p solo [gitgit repos]$ cd solo/ [gitgit solo]$ git --…

oracle数据泵导入很慢,impdp导入效率的问题

内网从一台服务器A导入到另一台服务器B,38G的数据半个多小时才导了一个表。原来B库上是有数据的,是不是因为TABLE_EXISTS_ACTIONREPLACE 导致速度慢了?parallel8也不知道会不会设高了。SQL> show parameter cpuNAME …

BZOJ2597 WC2007剪刀石头布(费用流)

考虑使非剪刀石头布情况尽量少。设第i个人赢了xi场,那么以i作为赢家的非剪刀石头布情况就为xi(xi-1)/2种。那么使Σxi(xi-1)/2尽量小即可。 考虑网络流。将比赛建成一排点,人建成一排点,每场未确定比赛向比赛双方连边,确定比赛向赢…

数据科学还是计算机科学_数据科学101

数据科学还是计算机科学什么是数据科学? (What is data science?) Well, if you have just woken up from a 10-year coma and have no idea what is data science, don’t worry, there’s still time. Many years ago, statisticians had some pretty good ideas…

开机流程与主引导分区(MBR)

由于操作系统会提供所有的硬件并且提供内核功能,因此我们的计算机就能够认识硬盘内的文件系统,并且进一步读取硬盘内的软件文件与执行该软件来完成各项软件的执行目的 问题是你有没有发现,既然操作系统也是软件,那么我的计算机优势…

肤色检测算法 - 基于二次多项式混合模型的肤色检测。

由于CSDN博客和博客园的编辑方面有不一致的地方,导致文中部分图片错位,为不影响浏览效果,建议点击打开链接。 由于能力有限,算法层面的东西自己去创新的很少,很多都是从现有的论文中学习,然后实践的。 本文…

oracle解析儒略日,利用to_char获取当前日期准确的周数!

总的来说周数的算法有两种:算法一:iw算法,每周为星期一到星期日算一周,且每年的第一个星期一为第一周,就拿2014年来说,2014-01-01是星期三,但还是算为今年的第一周,可以简单的用sql函…

密码机

树状数组1 #include<bits/stdc.h>2 using namespace std;3 int x,y,c[200005];4 char str[20];5 int inline read(){6 int x0,f1;7 char chgetchar();8 while(ch<0||ch>9)9 chgetchar(); 10 while(ch>0&&ch<9){ 11 …

js有默认参数的函数加参数_函数参数:默认,关键字和任意

js有默认参数的函数加参数PYTHON开发人员的提示 (TIPS FOR PYTHON DEVELOPERS) Think that you are writing a function that accepts multiple parameters, and there is often a common value for some of these parameters. For instance, you would like to be able to cal…

sql management studio 附加mdf文件出错的解决办法

将mdf文件所在文件夹的权限改为everyone.&#xff0c;完全控制即可。

oracle raise_application_error,RAISE_ APPLICATION_ ERROR--之异常处理

平时用来测试的异常处理我们都是通过dbms_output.put_line来输出异常信息&#xff0c;但是在实际的应用中&#xff0c;需要把异常信息返回给调用的客户端。其实 RAISE_APPLICATION_ERROR 是将应用程序专有的错误从服务器端转达到客户端应用程序(其他机器上的SQLPLUS或者其他前台…

金融信息交换协议

随着网络的使用&#xff0c;目前所有大型的金融机构都已经实现了自动化和数字化。当中肯定少不了互联网的加入&#xff0c;那么在这当中&#xff0c;我们主要介绍一下FIX协议。它是由国际FIX协会组织提供的一个开放式协议&#xff0c;目的是推动国际贸易电子化的进程&#xff0…

2018大数据学习路线从入门到精通

最近很多人问小编现在学习大数据这么多&#xff0c;他们都是如何学习的呢。很多初学者在萌生向大数据方向发展的想法之后&#xff0c;不免产生一些疑问&#xff0c;应该怎样入门&#xff1f;应该学习哪些技术&#xff1f;学习路线又是什么&#xff1f;今天小编特意为大家整理了…

相似邻里算法_纽约市-邻里之战

相似邻里算法IBM Data Science Capstone ProjectIBM Data Science Capstone项目 分析和可视化与服装店投资者的要求有关的纽约市结构 (Analyzing and visualizing the structure of New York City in relation to the requirements of a Clothing Store Investor) 介绍 (Introd…

一、面向对象

第一节&#xff1a;面向对象编程1.面向对象三大原则&#xff1a;封装&#xff1a;就是把客观事物封装成抽象的类&#xff0c;并且类可以把自己的数据和方法只让可信的类或者对象操作&#xff0c;对不可信的进行信息隐藏。继承&#xff1a;继承&#xff0c;指可以让某个类型的对…

[poj 1364]King[差分约束详解(续篇)][超级源点][SPFA][Bellman-Ford]

题意 有n个数的序列, 下标为[1.. N ], 限制条件为: 下标从 si 到 sini 的项求和 < 或 > ki. 一共有m个限制条件. 问是否存在满足条件的序列. 思路 转化为差分约束, 就是 即 Si 为第 i 项的前缀和, 特别的 So 为0. 转化不等式(连续子段和变为前缀和之差 > < 变为 &g…