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

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.

主站蜘蛛池模板: 铜川市| 休宁县| 玉田县| 三亚市| 峨眉山市| 轮台县| 锡林浩特市| 甘谷县| 隆林| 大宁县| 手机| 平安县| 甘肃省| 湄潭县| 武山县| 德阳市| 武夷山市| 睢宁县| 射阳县| 林芝县| 锦州市| 巍山| 临沭县| 孙吴县| 大洼县| 清流县| 武威市| 兴安盟| 合川市| 沧州市| 中方县| 葵青区| 扶余县| 黑水县| 阳城县| 赤峰市| 鄯善县| 瓦房店市| 莆田市| 郓城县| 丹寨县|