Python爬虫(三)——开封市58同城出租房决策树构建
决策树框架: 1 # coding=utf-8 2 import matplotlib.pyplot as plt 3 4 decisionNode = dict(boxstyle='sawtooth', fc='10') 5 leafNode = dict(boxstyle='round4', fc='0.8') 6 arrow_args = dict(arrowstyle='<-') 7 8 9 def plotNode(nodeTxt, centerPt, parentPt, nodeType): 10 createPlot.ax1.annotate(nodeTxt, xy=parentPt, xycoords='axes fraction', \ 11 xytext=centerPt, textcoords='axes fraction', \ 12 va='center', ha='center', bbox=nodeType, arrowprops \ 13 =arrow_args) 14 15 16 def getNumLeafs(myTree): 17 numLe...