决策树算法:【回归】预测隐形眼镜类型
从《【分类】鱼》中调用creatTree
从《Matplotlib注释绘制树形图》中调用creatPlot
from treesfish import createTree
from treesplot import createPlot
fr = open('lenses.txt')
lenses = [inst.strip().split('\t') for inst in fr.readlines()]
lensesLabels = ['age', 'prescript', 'astigmatic', 'tearRate']
lensesTree=createTree(lenses,lensesLabels)
print(lensesTree)
createPlot(lensesTree)