(inTree)
| 329 | 2017-07-24 |
| 330 | """ |
| 331 | def 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 | 函数说明:使用决策树分类 |
no test coverage detected