⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 人智算法基本程序
💻
字号:
				    Decision Tree ProgramWelcome to the wonderful world of the Decision Tree C++directory. This program demonstrates building a decision tree given anumber of examples with classifications. It is meant to be a companionto chapter 5 of the "Artificial Intelligence" textbook.  Thiscode was written by Jon Monsarrat, jgm@cs.brown.edu.Five sections describe the program:1. The problem2. Building the program3. Making example files4. Running the program5. The solution, and how to read the source code----------------------------------------------------------------------1. The problemThe book goes into quite some detail about the problem, but here it isin a nutshell.We have some dimensions and some classes. We are given a number ofexamples, each of which has a class and a value for each dimension. Webuild a decision tree. Each node in the decision tree is either aterminal node or a non-terminal node. Terminal nodes are associatedwith examples. Non-terminal nodes are associated with attributes whichyou could consider to be "questions". When the decision tree is built,a walk from the root down down, answering "questions", will bring youto the node with the classification you want.----------------------------------------------------------------------2. Building the programThe source code in this directory is complete and does not depend uponany other source code from the textbook. It only uses standardand libraries which should come any C++ compiler.You can build this program in UNIX by simply typing      makeYou may need to edit the Makefile to change the name of the compiler,if you do not have a compiler named "CC".You do not need to recompile the program to change examples. Examplesare stored in files.----------------------------------------------------------------------3. Making example files and running the programAn example file specifies the classes, the dimensions (the attributesand their possible values) and all the examples. It is laid out inthis order:   1. the word "classes", followed by the number of classes and their names   2. the word "dimensions", followed by the number of dimensions   3. Each dimension in order, which includes      a. the name of the attribute      b. the number of values      c. the names of all the values   4. the word "examples", followed by each example, which includes      a. The name of this example      b. The classifications of the example      c. All the values of the example, in the same ordering as the dimensions----------------------------------------------------------------------4. Running the programRunning the program is very simple. Just type   decision filenamewhere "filename" is the name of the example file you want to read in.----------------------------------------------------------------------5. The solution, and how to read the source codeBecause the complexity of this program lies in the data structures andloops, this program does not match the Lisp program entirely. However,most of the function names are the same.The classes are:   Decision    -- The entire decision tree is stored here   Dimension   -- A single dimension (with attributes and possible values)   Example     -- A single example (with classification and values)   Node        -- A node in decision tree (a splitting attribute and children)A single root node is created and the examples are all read intothe root node. Then each dimension is tested with a metric "evaluate"that determines the disorder of the tree. The root node is split onthe dimension with the lowest metric. This splitting continues recursivelyon all the root node's children until all nodes in the decision treeare either non-terminals with a splitting attribute, or are terminalswith a set of examples.There are 4 source files in this directory:   Decision.C   Contains the decision tree and the class/dimension info   Dimension.C  Contains the Dimension class   Example.C    Contains the Example class   Node.C       Contains the Node class   String.C     A generic strings library, a copy of the UNIX standardStart in Decision.C with the main() function if you want to read the code.----------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -