MCPcopy Create free account
hub / github.com/Jack-Cherish/Machine-Learning / createPlot

Function createPlot

Decision Tree/Decision Tree.py:331–340  ·  view source on GitHub ↗
(inTree)

Source from the content-addressed store, hash-verified

329 2017-07-24
330"""
331def createPlot(inTree):
332 fig = plt.figure(1, facecolor='white') #创建fig
333 fig.clf() #清空fig
334 axprops = dict(xticks=[], yticks=[])
335 createPlot.ax1 = plt.subplot(111, frameon=False, **axprops) #去掉x、y轴
336 plotTree.totalW = float(getNumLeafs(inTree)) #获取决策树叶结点数目
337 plotTree.totalD = float(getTreeDepth(inTree)) #获取决策树层数
338 plotTree.xOff = -0.5/plotTree.totalW; plotTree.yOff = 1.0; #x偏移
339 plotTree(inTree, (0.5,1.0), '') #绘制决策树
340 plt.show() #显示绘制结果
341
342"""
343函数说明:使用决策树分类

Callers 1

Decision Tree.pyFile · 0.85

Calls 3

getNumLeafsFunction · 0.85
getTreeDepthFunction · 0.85
plotTreeFunction · 0.85

Tested by

no test coverage detected