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

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.

主站蜘蛛池模板: 彭山县| 内黄县| 罗江县| 古田县| 丰原市| 南郑县| 双柏县| 临城县| 河曲县| 镇康县| 杭锦旗| 榕江县| 昂仁县| 二连浩特市| 宣武区| 穆棱市| 阿克| 河北区| 盐池县| 阿拉善左旗| 绥滨县| 沅江市| 思南县| 渝中区| 墨脱县| 遂宁市| 吴桥县| 安化县| 光泽县| 南召县| 固原市| 文山县| 巩留县| 金沙县| 太湖县| 丽水市| 开封市| 广元市| 台江县| 万载县| 黔西县|