f1ames / orchid3js

Library for building decision trees with js. Based on ID3 algorithm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

orchid3js

Library for building decision trees with js. Based on ID3 algorithm.

Pretty simple and straightforward to use. Just include the script e.g.

<script type="text/javascript" src="orchid3.min.js"></script>

then you can use factory to build tree

var tree = orchid3.factory(trainingSetAsString, rowsSeparator, valuesSeparator);

To test tree (or rather get decision) use getDecision method

tree.getDecision(sampleData);

Example

var set = 'sunny,hot,high,weak,no;sunny,hot,high,strong,no;overcast,hot,high,weak,yes;',
    test = orchid3.Util.parseData('sunny,hot,high,weak', ';', ','), //or test can already be an array like [['sunny', 'hot', 'high', 'weak']]
    tree = orchid3.factory(set, ';', ',');
tree.getDecision(test); //should return 'no'

See our demo for working, testable example and sample view class for drawing the tree!

About

Library for building decision trees with js. Based on ID3 algorithm.

License:MIT License


Languages

Language:JavaScript 95.1%Language:CSS 4.9%