Click here to Skip to main content
Click here to Skip to main content

ID3 Decision Tree Algorithm in C#

, 21 Oct 2003
Rate this:
Please Sign up or sign in to vote.
Sample of ID3 Decision Tree Algorithm in C#

Introduction

The algorithm ID3 (Quinlan) uses the method top-down induction of decision trees. Given a set of classified examples a decision tree is induced, biased by the information gain measure, which heuristically leads to small trees. The examples are given in attribute-value representation. The set of possible classes is finite. Only tests, that split the set of instances of the underlying example languages depending on the value of a single attribute are supported.

Details

Depending on whether the attributes are nominal or numerical, the tests either

  • have a successor for each possible attribute value, or
  • split according to a comparison of an attribute value to a constant, or depending on if an attribute value belongs to a certain interval or not.

The algorithm starts with the complete set of examples, a set of possible tests and the root node as the actual node. As long as the examples propagated to a node do not all belong to the same class and there are tests left,

  • a test with highest information gain is chosen,
  • the corresponding set of successors is created for the actual node,
  • each example is propagated to the successor given by the chosen test,
  • ID3 is called recursively for all successors.

How it works

The core of sample is builded with 3 classes (Attribute, TreeNode and DecisionTreeID3).

  • TreeNode - are the nodes of the decision tree;
  • Attribute - is the class with have a name e any possible values;
  • DecisionTreeID3 - is the class what get a data samples and generate a decision tree.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Roosevelt
Web Developer iddi
Brazil Brazil
No Biography provided
Follow on   Twitter

Comments and Discussions

 
Generalhelp me on project for internet advertisement prediction PinmemberMember 1131005414-Dec-14 8:24 
Questiondecision tree algorithm code PinmemberMember 109256204-Jul-14 18:57 
QuestionHi, can anyone help me to fix these errors? PinmemberKaushik Sampath Kumar24-Mar-13 8:54 
QuestionUrgent Help Pinmembernidhalhameed11-Nov-12 7:55 
Questionneed help in ID3 Decision Tree Algorithm in C# Pinmemberramireddyrasagna6-Feb-12 18:29 
Questionhelp in id3 decision tree algorithm in c# Pinmemberramireddyrasagna5-Feb-12 12:26 
GeneralNice code....but this code just for two class decision [modified] Pinmemberh4ckm03d27-Jul-11 3:24 
GeneralRe: Nice code....but this code just for two class decision PinmemberMuneer Safi15-Oct-12 22:03 
GeneralRe: Nice code....but this code just for two class decision PinmemberMember 109256204-Jul-14 18:54 
Generalhelp,id3 decision tree Pinmemberdhanyamc7-Jun-11 22:06 
Generalhelp id3 decision tree Pinmemberdhanyamc7-Jun-11 9:22 
GeneralRebuilt based on this code PinmemberTim Claason1-Feb-11 8:28 
Generalspliting criterion Pinmemberjamilehy2-Oct-10 13:04 
QuestionHow you defined new attributes in main? Pinmemberjamilehy30-Sep-10 18:28 
AnswerRe: How you defined new attributes in main? Pinmemberpol_chu2-Oct-10 10:31 
GeneralRe: How you defined new attributes in main? Pinmemberjamilehy2-Oct-10 12:40 
GeneralRe: How you defined new attributes in main? Pinmemberpol_chu2-Oct-10 20:16 
GeneralAn error report [modified] Pinmemberpol_chu9-Sep-10 23:44 
Generalerror Pinmemberlqht25-Apr-10 9:05 
GeneralError Pinmemberstrepto125-Apr-10 7:21 
Generalhi Pinmemberrodalyn15-Mar-10 19:15 
Generalhelp:id3 decision tree Pinmemberstd_112-Mar-10 2:34 
GeneralRe: help:id3 decision tree PinmemberSamBarakaba15-Oct-10 23:36 
GeneralRe: help:id3 decision tree Pinmemberleavetrace25-Oct-10 0:08 
GeneralRe: help:id3 decision tree Pinmemberleavetrace25-Oct-10 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 22 Oct 2003
Article Copyright 2003 by Roosevelt
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid