官术网_书友最值得收藏!

Decision Trees

Another popular supervised algorithm is the decision tree. A decision tree creates a classifier in the form of a tree. This is composed of decision nodes, where tests on specific attributes are performed; and leaf nodes, which indicate the value of the target attribute. To classify a new sample, we start at the root of the tree and navigate down the nodes until we reach a leaf.

A classic application of this algorithm is the Iris flower dataset (http://archive.ics.uci.edu/ml/datasets/Iris), which contains data from 50 samples of three types of Irises (Iris Setosa, Iris Virginica, and Iris Versicolor). Ronald Fisher, who created the dataset, measured four different features of these flowers:

  • The length of their sepals
  • The width of their sepals 
  • The length of their petals 
  • The width of their petals

Based on the different combinations of these features, it's possible to create a decision tree to decide which species each flower belongs to. In the following diagram, we have defined a decision tree that will correctly classify almost all the flowers using only two of these features, the petal length and width:

To classify a new sample, we start at the root note of the tree (petal length). If the sample satisfies the condition, we go left to the leaf, representing the Iris Setosa class. If not, we go right to a new node (petal width). This process continues until we reach a leaf. There are different ways to build decision trees, and we will discuss them later, in the chapter.

In recent years, decision trees have seen two major improvements. The first is Random Forests, which is an ensemble method that combines the predictions of multiple trees. The second is Gradient-Boosting Machines, which creates multiple sequential decision trees, where each tree tries to improve the errors made by the previous tree. Thanks to these improvements, decision trees have become very popular when working with certain types of data. For example, they are one of the most popular algorithms used in Kaggle competitions.

主站蜘蛛池模板: 高邑县| 古蔺县| 读书| 若尔盖县| 苗栗市| 新蔡县| 南雄市| 林周县| 渝中区| 富平县| 特克斯县| 牙克石市| 滦平县| 迭部县| 革吉县| 封开县| 高雄县| 宁明县| 辽源市| 芷江| 昆明市| 石台县| 马关县| 嘉鱼县| 葵青区| 扶绥县| 盐山县| 乌鲁木齐县| 金塔县| 潢川县| 台北市| 嘉黎县| 平顺县| 平江县| 乌恰县| 五寨县| 霞浦县| 炎陵县| 工布江达县| 友谊县| 岳西县|