Registry / other / decisiontree

decisiontree

JSON →
library0.5.0rbrubygemsunverified

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

other
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.

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 footguns

No known footguns recorded.

Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources