Skip to content

Commit

Permalink
Fix examples in README.md
Browse files Browse the repository at this point in the history
`test` variables were missing, second example referenced missing `data`
variable.
  • Loading branch information
lukeasrodgers committed Sep 19, 2014
1 parent 6fb6d84 commit 5412430
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 5412430

Please sign in to comment.