决策树
决策树是十大数据挖掘算法之一,在很多工程实践中都取得了很好的效果。其分类决策过程与20问游戏类似,专家系统中经常适用决策树,而且决策树给出结果往往可以匹敌在当前领域具有几十年工作经验的人类专家。
本文对决策树的基本原理,优缺点,应用场景等进行了简要的概述。此外将会陆续实现常用的机器学习和数据挖掘算法,有简单直观的notebook形式,也有python易用重用的代码。代码实践部分参考[4],数据也来源于课本附带的小的数据集,方便使用。
代码链接:https://github.com/hfl15/MLinAction
概述
优点:
计算复杂度不高,输出结果易于理解,对中间值的缺失不敏感,可以处理不相关特征数据[4]。
不需要领域知识和参数设置,可以处理高维数据,树型表示直观容易理解,学习和分类步骤简单、快速,一般有较好的准确率[3]
缺点:
可能产生过拟合[4]
适用数据类型:
标称型、数值型(需要离散化)[4]
关键字:
决策树归纳,分裂属性选择,剪枝
算法步骤
Input:
D: data set, contain value and class label
attribute_list : candidate attribute list
Attribute_selection_method: a process to select best split attribute in candidate attribute list
Return:
a decision tree
DecisionTree(D, attribute_list, Attribute_selection_method):
create a new node TNode; if all instance in D have the same class label C:
return TNode as a leaf node and label with class C;

