Friday, January 31, 2014

Decision Tree Generator (Implementation in Javascript)

Recently I tried making a simple Decision Tree Generator not because it wasn't there before but as a fun project to engage myself and learn abit of Javascript and also to know HTML5 Canvas a little more :)

fig: Output of Decision Tree Generator




What's so good about it?

Well there's not much to say, but hear it out anyway :D

1. Automatic Generator:
It gathers data, and automatically generates tree based on the data. Though I haven't tested it thoroughly, it worked for two of my example sets (that's good enough right ;) ? )

2. Interactive:
I have tried my best to make it as interactive as possible. I have added a bit of Jquery to make it more interesting :D

3. ID3 Algorithm Implementation:
It implements ID3 Algorithm for Decision Tree generation. More on the algorithm? Follow the link : Wikipedia

4. Source Code:
I have uploaded the project in github, so feel free to browse and help me with updates and suggestion. Here is the link: Project Source


How does it work?

Well, it takes your data as input. The data must be discrete and must contain a  class ( outcome ). The algorithm begins with data set 'S' as the root node. On each iteration of the algorithm, it loops through every unused attribute of 'S' and calculates the entropy H(S) (or information gain IG(A)) for that attribute.

Then selects the attribute which has the smallest entropy (or largest information gain) value. The set 'S' is then split by the selected attribute to produce subsets of the data. The algorithm continues to recurse on each subset, considering only attributes never selected before.


Wanna see it live?

Decision Tree Generator is live, here is the link: DecisionTree Generator

3 comments:

  1. Great Article!
    Check out www.apponix.com for more Java Tutorials

    ReplyDelete
  2. Evolution Gaming launches new casino game "Bits - Oklahomacasinoguru
    It is an exciting new addition to Evolution Gaming's portfolio as well 해외 배팅 사이트 as a 승부 예측 사이트 number of new 벳무브 casino 1xbet 우회 주소 games, including 파라오 도메인 Roulette, Blackjack,

    ReplyDelete
  3. To save yourself the hassle of analyzing tons of internet sites|of websites}, it’ll assist if you select from the ones we’ve listed on this review. Bitstarz provides an intuitive design, which implies it’s simple to use even when you’ve never played on-line on line casino games. However, we have been a bit dissatisfied with the house page, as it is too cluttered for our liking. Like Red Dog, Bitstarz is proscribed in terms of|when it comes to|by way of} on-line sports activities betting choices. When you play at our prime on-line playing sites, have the ability to|you presumably can} declare different types of|several varieties of|various varieties 1xbet of} bonuses. With the right bonus, you won’t only have a boosted bankroll to play games, but you also stand a chance to win one thing further.

    ReplyDelete