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

ID3 Decision Tree Algorithm in C#

By , 21 Oct 2003
 

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
No Biography provided

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

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionHi, can anyone help me to fix these errors?memberKaushik Sampath Kumar24 Mar '13 - 7:54 
QuestionUrgent Helpmembernidhalhameed11 Nov '12 - 6:55 
Questionneed help in ID3 Decision Tree Algorithm in C#memberramireddyrasagna6 Feb '12 - 17:29 
Questionhelp in id3 decision tree algorithm in c#memberramireddyrasagna5 Feb '12 - 11:26 
GeneralNice code....but this code just for two class decision [modified]memberh4ckm03d27 Jul '11 - 2:24 
GeneralRe: Nice code....but this code just for two class decisionmemberMuneer Safi15 Oct '12 - 21:03 
Generalhelp,id3 decision treememberdhanyamc7 Jun '11 - 21:06 
Generalhelp id3 decision treememberdhanyamc7 Jun '11 - 8:22 
GeneralRebuilt based on this codememberTim Claason1 Feb '11 - 7:28 
Generalspliting criterionmemberjamilehy2 Oct '10 - 12:04 
QuestionHow you defined new attributes in main?memberjamilehy30 Sep '10 - 17:28 
AnswerRe: How you defined new attributes in main?memberpol_chu2 Oct '10 - 9:31 
GeneralRe: How you defined new attributes in main?memberjamilehy2 Oct '10 - 11:40 
GeneralRe: How you defined new attributes in main?memberpol_chu2 Oct '10 - 19:16 
GeneralAn error report [modified]memberpol_chu9 Sep '10 - 22:44 
Generalerrormemberlqht25 Apr '10 - 8:05 
GeneralErrormemberstrepto125 Apr '10 - 6:21 
Generalhimemberrodalyn15 Mar '10 - 18:15 
Generalhelp:id3 decision treememberstd_112 Mar '10 - 1:34 
GeneralRe: help:id3 decision treememberSamBarakaba15 Oct '10 - 22:36 
GeneralRe: help:id3 decision treememberleavetrace24 Oct '10 - 23:08 
GeneralRe: help:id3 decision treememberleavetrace24 Oct '10 - 23:13 
GeneralRe: help:id3 decision treememberleavetrace24 Oct '10 - 23:16 
GeneralRe: help:id3 decision treememberleavetrace24 Oct '10 - 23:18 
GeneralMy vote of 1memberCode Deamon20 Apr '09 - 4:27 

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

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