decisiontree 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +3 -0
- data/History.txt +0 -0
- data/Manifest.txt +18 -0
- data/README.txt +15 -0
- data/Rakefile +53 -0
- data/examples/continuous-id3.rb +33 -0
- data/examples/data/continuous-test.txt +13 -0
- data/examples/data/continuous-training.txt +133 -0
- data/examples/data/discrete-test.txt +4 -0
- data/examples/data/discrete-training.txt +21 -0
- data/examples/discrete-id3.rb +34 -0
- data/lib/decisiontree.rb +1 -0
- data/lib/decisiontree/id3_tree.rb +132 -0
- data/lib/decisiontree/version.rb +9 -0
- data/setup.rb +1585 -0
- data/test/test_decisiontree.rb +26 -0
- data/test/test_helper.rb +2 -0
- metadata +62 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
#The MIT License
|
2
|
+
|
3
|
+
###Copyright (c) 2007 Ilya Grigorik <ilya AT fortehost DOT com>
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
require 'decisiontree'
|
7
|
+
|
8
|
+
class TestDecisionTree < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@labels = %w(sun rain)
|
12
|
+
@data = [
|
13
|
+
[1, 0, 1],
|
14
|
+
[0, 1, 0]
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_truth
|
19
|
+
dec_tree = DecisionTree::ID3Tree.new(@labels, @data, 1, :discrete)
|
20
|
+
dec_tree.train
|
21
|
+
|
22
|
+
assert 1, dec_tree.predict([1, 0])
|
23
|
+
assert 0, dec_tree.predict([0, 1])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: decisiontree
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2007-04-16 00:00:00 -04:00
|
8
|
+
summary: ID3-based implementation of the M.L. Decision Tree algorithm
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: ilya <at> fortehost.com
|
12
|
+
homepage: http://decisiontree.rubyforge.org
|
13
|
+
rubyforge_project: decisiontree
|
14
|
+
description: ID3-based implementation of the M.L. Decision Tree algorithm
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Ilya Grigorik
|
31
|
+
files:
|
32
|
+
- CHANGELOG.txt
|
33
|
+
- History.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- lib/decisiontree.rb
|
38
|
+
- lib/decisiontree/version.rb
|
39
|
+
- lib/decisiontree/id3_tree.rb
|
40
|
+
- examples/continuous-id3.rb
|
41
|
+
- examples/discrete-id3.rb
|
42
|
+
- examples/data/continuous-test.txt
|
43
|
+
- examples/data/discrete-test.txt
|
44
|
+
- examples/data/continuous-training.txt
|
45
|
+
- examples/data/discrete-training.txt
|
46
|
+
- setup.rb
|
47
|
+
- test/test_helper.rb
|
48
|
+
- test/test_decisiontree.rb
|
49
|
+
test_files: []
|
50
|
+
|
51
|
+
rdoc_options: []
|
52
|
+
|
53
|
+
extra_rdoc_files: []
|
54
|
+
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
requirements: []
|
60
|
+
|
61
|
+
dependencies: []
|
62
|
+
|