Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #24 from lukeasrodgers/fix-readme

Fix examples in README.md
  • Loading branch information...
commit eaa9a2f5d7244ced34fd28d9a38556bbe6e1969e 2 parents 6fb6d84 + 5412430
@igrigorik authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 README.md
View
14 README.md
@@ -37,8 +37,9 @@ training = [
dec_tree = DecisionTree::ID3Tree.new(attributes, training, 'sick', :continuous)
dec_tree.train
-decision = dec_tree.predict([37, 'sick'])
-puts "Predicted: #{decision} ... True decision: #{test.last}";
+test = [37, 'sick']
+decision = dec_tree.predict(test)
+puts "Predicted: #{decision} ... True decision: #{test.last}"
# => Predicted: sick ... True decision: sick
@@ -55,11 +56,14 @@ training = [
[1, "red", "not angry"]
]
-dec_tree = DecisionTree::ID3Tree.new(labels, data, "not angry", color: :discrete, hunger: :continuous)
+dec_tree = DecisionTree::ID3Tree.new(labels, training, "not angry", color: :discrete, hunger: :continuous)
dec_tree.train
-decision = dec_tree.predict([7, "red"])
-puts "Predicted: #{decision} ... True decision: #{test.last}";
+test = [7, "red", "angry"]
+decision = dec_tree.predict(test)
+puts "Predicted: #{decision} ... True decision: #{test.last}"
+
+# => Predicted: angry ... True decision: angry
```
## License
Please sign in to comment.
Something went wrong with that request. Please try again.