91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

機器學(xué)習(xí)決策樹

資源截圖

代碼片段和文件信息

import?operator
from?math?import?log
import?matplotlib.pyplot?as?plt


def?createDataSet():
????dataSet?=?[[1?1?‘yes‘]
???????????????[1?1?‘yes‘]
???????????????[1?0?‘no‘]
???????????????[0?1?‘no‘]
???????????????[0?1?‘no‘]]
????labels?=?[‘不浮出水面是否可以生存‘?‘是否有腳蹼‘]
????return?dataSet?labels


#?計算香農(nóng)熵
def?calcShannonEnt(dataSet):
????numEntries?=?len(dataSet)
????labelCounts?=?{}
????for?feaVec?in?dataSet:
????????currentLabel?=?feaVec[-1]
????????if?currentLabel?not?in?labelCounts:
????????????labelCounts[currentLabel]?=?0
????????labelCounts[currentLabel]?+=?1
????shannonEnt?=?0.0
????for?key?in?labelCounts:
????????prob?=?float(labelCounts[key])?/?numEntries
????????shannonEnt?-=?prob?*?log(prob?2)
????return?shannonEnt


def?splitDataSet(dataS

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????7108??2019-03-13?16:42??機器學(xué)習(xí)決策樹兩個經(jīng)典案例\決策樹.py

?????文件???????9491??2019-03-13?16:23??機器學(xué)習(xí)決策樹兩個經(jīng)典案例\決策樹動物分類.py

?????文件???????7876??2019-03-08?14:36??機器學(xué)習(xí)決策樹兩個經(jīng)典案例\決策樹天氣判斷是否出玩.py

?????目錄??????????0??2019-05-09?11:19??機器學(xué)習(xí)決策樹兩個經(jīng)典案例

-----------?---------??----------?-----??----

????????????????24475????????????????????4


評論

共有 條評論

相關(guān)資源