decision_tree 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 +54 -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/decision_tree/id3_tree.rb +132 -0
- data/lib/decision_tree/version.rb +9 -0
- data/lib/decision_tree.rb +2 -0
- data/setup.rb +1585 -0
- data/test/test_decision_tree.rb +25 -0
- data/test/test_helper.rb +2 -0
- metadata +56 -0
@@ -0,0 +1,25 @@
|
|
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 'decision_tree'
|
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
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: decision_tree
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2007-04-05 00:00:00 +00: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://decision_tree.rubyforge.org
|
13
|
+
rubyforge_project: decision_tree
|
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
|
+
- ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: ruby
|
27
|
+
signing_key:
|
28
|
+
cert_chain:
|
29
|
+
post_install_message:
|
30
|
+
authors:
|
31
|
+
- Ilya Grigorik
|
32
|
+
files:
|
33
|
+
- CHANGELOG.txt
|
34
|
+
- History.txt
|
35
|
+
- Manifest.txt
|
36
|
+
- README.txt
|
37
|
+
- Rakefile
|
38
|
+
- lib/decision_tree.rb
|
39
|
+
- lib/decision_tree/version.rb
|
40
|
+
- lib/decision_tree/id3_tree.rb
|
41
|
+
- setup.rb
|
42
|
+
- examples/continuous-id3.rb
|
43
|
+
- examples/discrete-id3.rb
|
44
|
+
- examples/data/continuous-test.txt
|
45
|
+
- examples/data/continuous-training.txt
|
46
|
+
- examples/data/discrete-test.txt
|
47
|
+
- examples/data/discrete-training.txt
|
48
|
+
- test/test_helper.rb
|
49
|
+
- test/test_decision_tree.rb
|
50
|
+
test_files: []
|
51
|
+
rdoc_options: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
executables: []
|
54
|
+
extensions: []
|
55
|
+
requirements: []
|
56
|
+
dependencies: []
|