Click here to Skip to main content
Licence 
First Posted 21 Oct 2003
Views 132,172
Downloads 3,317
Bookmarked 51 times

ID3 Decision Tree Algorithm in C#

By Roosevelt | 21 Oct 2003
Sample of ID3 Decision Tree Algorithm in C#
10 votes, 27.8%
1
3 votes, 8.3%
2
5 votes, 13.9%
3
7 votes, 19.4%
4
11 votes, 30.6%
5
2.79/5 - 36 votes
μ 2.78, σa 2.85 [?]

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

About the Author

Roosevelt

Web Developer

Brazil Brazil

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questionneed help in ID3 Decision Tree Algorithm in C# Pinmemberramireddyrasagna18:29 6 Feb '12  
Questionhelp in id3 decision tree algorithm in c# Pinmemberramireddyrasagna12:26 5 Feb '12  
SuggestionNice code....but this code just for two class decision Pinmemberh4ckm03d3:24 27 Jul '11  
Generalhelp,id3 decision tree Pinmemberdhanyamc22:06 7 Jun '11  
Generalhelp id3 decision tree Pinmemberdhanyamc9:22 7 Jun '11  
GeneralRebuilt based on this code PinmemberTim Claason8:28 1 Feb '11  
Generalspliting criterion Pinmemberjamilehy13:04 2 Oct '10  
QuestionHow you defined new attributes in main? Pinmemberjamilehy18:28 30 Sep '10  
AnswerRe: How you defined new attributes in main? Pinmemberpol_chu10:31 2 Oct '10  
GeneralRe: How you defined new attributes in main? Pinmemberjamilehy12:40 2 Oct '10  
GeneralRe: How you defined new attributes in main? Pinmemberpol_chu20:16 2 Oct '10  
GeneralAn error report [modified] Pinmemberpol_chu23:44 9 Sep '10  
Generalerror Pinmemberlqht9:05 25 Apr '10  
GeneralError Pinmemberstrepto17:21 25 Apr '10  
Generalhi Pinmemberrodalyn19:15 15 Mar '10  
Generalhelp:id3 decision tree Pinmemberstd_12:34 12 Mar '10  
GeneralRe: help:id3 decision tree PinmemberSamBarakaba23:36 15 Oct '10  
GeneralRe: help:id3 decision tree Pinmemberleavetrace0:08 25 Oct '10  
GeneralRe: help:id3 decision tree Pinmemberleavetrace0:13 25 Oct '10  
GeneralRe: help:id3 decision tree Pinmemberleavetrace0:16 25 Oct '10  
GeneralRe: help:id3 decision tree Pinmemberleavetrace0:18 25 Oct '10  
GeneralMy vote of 1 PinmemberCode Deamon5:27 20 Apr '09  
Questioncan not work with more than two class Pinmemberleavetrace19:50 1 Jan '09  
GeneralI think there's a mistake, correct me if i'm wrong Pinmemberrock_me7:56 1 Jul '08  
QuestionDo u interested in association rule? Pinmemberalice_nhan5:39 27 Nov '07  

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.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120209.1 | Last Updated 22 Oct 2003
Article Copyright 2003 by Roosevelt
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid