update project structure

This commit is contained in:
Ilya Grigorik
2012-10-26 21:33:45 -07:00
parent d1dce9be91
commit bb9327b54b
7 changed files with 35 additions and 134 deletions

View File

@@ -2,6 +2,20 @@ require 'spec_helper'
describe describe DecisionTree::ID3Tree do
describe "simple discrete case" do
Given(:labels) { ["sun", "rain"]}
Given(:data) do
[
[1,0,1],
[0,1,0]
]
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, 1, :discrete) }
When { tree.train }
Then { tree.predict([1,0]).should == 1 }
Then { tree.predict([0,1]).should == 0 }
end
describe "discrete attributes" do
Given(:labels) { ["hungry", "color"] }
Given(:data) do
@@ -60,5 +74,4 @@ describe describe DecisionTree::ID3Tree do
Then { tree.predict([2, "blue"]).should == "not angry" }
end
end