決策樹信息熵計算_決策樹熵|熵計算

決策樹信息熵計算

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.pswp.cn/news/388617.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388617.shtml
英文地址,請注明出處:http://en.pswp.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…