Registry / other / decisiontree

decisiontree

JSON →
library0.5.0rbrubygemsunverified

ID3-based implementation of the M.L. Decision Tree algorithm.

gem install decisiontree
INSTALL
IMPORT
SIG · DECISIONTREE
D
decisiontree
otherrubyv0.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DecisionTree
✓ require 'decisiontree'

Train a decision tree and make a prediction

require 'decisiontree' # Example: predict whether to play tennis based on weather attributes = ['outlook', 'temperature', 'humidity', 'wind'] training = [ ['sunny', 'hot', 'high', 'weak', 'no'], ['sunny', 'hot', 'high', 'strong', 'no'], ['overcast', 'hot', 'high', 'weak', 'yes'], ['rainy', 'mild', 'high', 'weak', 'yes'], ['rainy', 'cool', 'normal', 'weak', 'yes'], ['rainy', 'cool', 'normal', 'strong', 'no'], ['overcast', 'cool', 'normal', 'strong', 'yes'], ['sunny', 'mild', 'high', 'weak', 'no'], ['sunny', 'cool', 'normal', 'weak', 'yes'], ['rainy', 'mild', 'normal', 'weak', 'yes'], ['sunny', 'mild', 'normal', 'strong', 'yes'], ['overcast', 'mild', 'high', 'strong', 'yes'], ['overcast', 'hot', 'normal', 'weak', 'yes'], ['rainy', 'mild', 'high', 'strong', 'no'] ] dec_tree = DecisionTree::ID3Tree.new(attributes, training, 'no', :continuous) dec_tree.train test = ['sunny', 'hot', 'high', 'weak'] prediction = dec_tree.predict(test) puts prediction
Debug
Known issues

No known issues recorded.

Upgrade
Version history
0.5.0latest on RubyGems
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
decisiontree — gem install decisiontree · libregistry