ai4r 1.6 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ai4r/classifiers/hyperpipes.rb +10 -10
- data/lib/ai4r/data/data_set.rb +16 -12
- data/test/classifiers/hyperpipes_test.rb +84 -0
- data/test/clusterers/diana_test.rb +68 -68
- data/test/data/data_set_test.rb +10 -8
- metadata +90 -83
- data/lib/ai4r/data/constants.rb +0 -18
@@ -8,7 +8,6 @@
|
|
8
8
|
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
|
9
9
|
|
10
10
|
require 'set'
|
11
|
-
require File.dirname(__FILE__) + '/../data/constants'
|
12
11
|
require File.dirname(__FILE__) + '/../data/data_set'
|
13
12
|
require File.dirname(__FILE__) + '/../classifiers/classifier'
|
14
13
|
|
@@ -29,12 +28,13 @@ module Ai4r
|
|
29
28
|
# as parameter. The last attribute of each item is considered as
|
30
29
|
# the item class.
|
31
30
|
def build(data_set)
|
31
|
+
data_set.check_not_empty
|
32
32
|
@data_set = data_set
|
33
33
|
@domains = data_set.build_domains
|
34
34
|
|
35
35
|
@pipes = {}
|
36
|
-
@domains.last.each {|cat| @pipes[cat] = build_pipe(@
|
37
|
-
@data_set.
|
36
|
+
@domains.last.each {|cat| @pipes[cat] = build_pipe(@data_set)}
|
37
|
+
@data_set.data_items.each {|item| update_pipe(@pipes[item.last], item) }
|
38
38
|
|
39
39
|
return self
|
40
40
|
end
|
@@ -47,7 +47,7 @@ module Ai4r
|
|
47
47
|
@pipes.each do |category, pipe|
|
48
48
|
pipe.each_with_index do |bounds, i|
|
49
49
|
if data[i].is_a? Numeric
|
50
|
-
votes[category]+=1 if data[i]
|
50
|
+
votes[category]+=1 if data[i]>=bounds[:min] && data[i]<=bounds[:max]
|
51
51
|
else
|
52
52
|
votes[category]+=1 if bounds[data[i]]
|
53
53
|
end
|
@@ -79,15 +79,15 @@ module Ai4r
|
|
79
79
|
pipe.each_with_index do |bounds, i|
|
80
80
|
rule = "votes['#{category}'] += 1 "
|
81
81
|
if data[i].is_a? Numeric
|
82
|
-
rule += "if #{labels[i]}
|
82
|
+
rule += "if #{labels[i]} >= #{bounds[:min]} && #{labels[i]} <= #{bounds[:max]}"
|
83
83
|
else
|
84
|
-
rule += "if #{bounds.inspect}[
|
84
|
+
rule += "if #{bounds.inspect}[#{labels[i]}]"
|
85
85
|
end
|
86
86
|
rules << rule
|
87
87
|
end
|
88
88
|
end
|
89
|
-
rules << "votes.to_a.max {|x, y| x.last <=> y.last}.first"
|
90
|
-
return rules.join(
|
89
|
+
rules << "#{labels.last} = votes.to_a.max {|x, y| x.last <=> y.last}.first"
|
90
|
+
return rules.join("\n")
|
91
91
|
end
|
92
92
|
|
93
93
|
protected
|
@@ -95,7 +95,7 @@ module Ai4r
|
|
95
95
|
def build_pipe(data_set)
|
96
96
|
data_set.data_items.first[0...-1].collect do |att|
|
97
97
|
if att.is_a? Numeric
|
98
|
-
{:min=>
|
98
|
+
{:min=>1.0/0, :max=>-1.0/0}
|
99
99
|
else
|
100
100
|
Hash.new(false)
|
101
101
|
end
|
@@ -104,7 +104,7 @@ module Ai4r
|
|
104
104
|
|
105
105
|
def update_pipe(pipe, data_item)
|
106
106
|
data_item[0...-1].each_with_index do |att, i|
|
107
|
-
if att.
|
107
|
+
if att.is_a? Numeric
|
108
108
|
pipe[i][:min] = att if att < pipe[i][:min]
|
109
109
|
pipe[i][:max] = att if att > pipe[i][:max]
|
110
110
|
else
|
data/lib/ai4r/data/data_set.rb
CHANGED
@@ -121,36 +121,40 @@ module Ai4r
|
|
121
121
|
return self
|
122
122
|
end
|
123
123
|
|
124
|
-
# Returns an array with the domain of each attribute
|
125
|
-
# containing all possible values
|
124
|
+
# Returns an array with the domain of each attribute:
|
125
|
+
# * Set instance containing all possible values for nominal attributes
|
126
|
+
# * Array with min and max values for numeric attributes (i.e. [min, max])
|
127
|
+
#
|
126
128
|
# Return example:
|
127
129
|
# => [#<Set: {"New York", "Chicago"}>,
|
128
130
|
# #<Set: {"<30", "[30-50)", "[50-80]", ">80"}>,
|
129
|
-
# #<Set: {"M", "F"}>,
|
131
|
+
# #<Set: {"M", "F"}>,
|
132
|
+
# [5, 85],
|
130
133
|
# #<Set: {"Y", "N"}>]
|
131
134
|
def build_domains
|
132
|
-
|
133
|
-
@data_items.each do |data|
|
134
|
-
data.each_index {|attr_index| domains[attr_index] << data[attr_index]}
|
135
|
-
end
|
136
|
-
return domains
|
135
|
+
@data_labels.collect {|attr_label| build_domain(attr_label) }
|
137
136
|
end
|
138
137
|
|
139
138
|
# Returns a Set instance containing all possible values for an attribute
|
140
139
|
# The parameter can be an attribute label or index (0 based).
|
140
|
+
# * Set instance containing all possible values for nominal attributes
|
141
|
+
# * Array with min and max values for numeric attributes (i.e. [min, max])
|
141
142
|
#
|
142
143
|
# build_domain("city")
|
143
144
|
# => #<Set: {"New York", "Chicago"}>
|
145
|
+
#
|
146
|
+
# build_domain("age")
|
147
|
+
# => [5, 85]
|
144
148
|
#
|
145
149
|
# build_domain(2) # In this example, the third attribute is gender
|
146
150
|
# => #<Set: {"M", "F"}>
|
147
151
|
def build_domain(attr)
|
148
152
|
index = get_index(attr)
|
149
|
-
|
150
|
-
|
151
|
-
|
153
|
+
if @data_items.first[index].is_a?(Numeric)
|
154
|
+
return [Statistics.min(self, index), Statistics.max(self, index)]
|
155
|
+
else
|
156
|
+
return @data_items.inject(Set.new){|domain, x| domain << x[index]}
|
152
157
|
end
|
153
|
-
return domain
|
154
158
|
end
|
155
159
|
|
156
160
|
# Returns attributes number, including class attribute
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Author:: Sergio Fierens
|
2
|
+
# License:: MPL 1.1
|
3
|
+
# Project:: ai4r
|
4
|
+
# Url:: http://ai4r.rubyforge.org/
|
5
|
+
#
|
6
|
+
# You can redistribute it and/or modify it under the terms of
|
7
|
+
# the Mozilla Public License version 1.1 as published by the
|
8
|
+
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + '/../../lib/ai4r/classifiers/hyperpipes'
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
class Ai4r::Classifiers::Hyperpipes
|
14
|
+
attr_accessor :data_set, :pipes
|
15
|
+
end
|
16
|
+
|
17
|
+
include Ai4r::Classifiers
|
18
|
+
include Ai4r::Data
|
19
|
+
|
20
|
+
class HyperpipesTest < Test::Unit::TestCase
|
21
|
+
|
22
|
+
@@data_labels = [ 'city', 'age', 'gender', 'marketing_target' ]
|
23
|
+
|
24
|
+
@@data_items = [['New York', 25, 'M', 'Y'],
|
25
|
+
['New York', 23, 'M', 'Y'],
|
26
|
+
['New York', 18, 'M', 'Y'],
|
27
|
+
['Chicago', 43, 'M', 'Y'],
|
28
|
+
['New York', 34, 'F', 'N'],
|
29
|
+
['Chicago', 33, 'F', 'Y'],
|
30
|
+
['New York', 31, 'F', 'N'],
|
31
|
+
['Chicago', 55, 'M', 'N'],
|
32
|
+
['New York', 58, 'F', 'N'],
|
33
|
+
['New York', 59, 'M', 'N'],
|
34
|
+
['Chicago', 71, 'M', 'N'],
|
35
|
+
['New York', 60, 'F', 'N'],
|
36
|
+
['Chicago', 85, 'F', 'Y']
|
37
|
+
]
|
38
|
+
|
39
|
+
|
40
|
+
def setup
|
41
|
+
Hyperpipes.send(:public, *Hyperpipes.protected_instance_methods)
|
42
|
+
@data_set = DataSet.new(:data_items => @@data_items, :data_labels => @@data_labels)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_build_pipe
|
46
|
+
classifier = Hyperpipes.new
|
47
|
+
assert_equal [{}, {:max=>-1.0/0, :min=>1.0/0}, {}], classifier.build_pipe(@data_set)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_get_rules
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_build
|
55
|
+
assert_raise(ArgumentError) { Hyperpipes.new.build(DataSet.new) }
|
56
|
+
classifier = Hyperpipes.new.build(@data_set)
|
57
|
+
assert classifier.pipes.include?("Y")
|
58
|
+
assert classifier.pipes.include?("N")
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_eval
|
62
|
+
classifier = Hyperpipes.new.build(@data_set)
|
63
|
+
assert classifier
|
64
|
+
assert_equal('N', classifier.eval(['Chicago', 55, 'M']))
|
65
|
+
assert_equal('N', classifier.eval(['New York', 35, 'F']))
|
66
|
+
assert_equal('Y', classifier.eval(['New York', 25, 'M']))
|
67
|
+
assert_equal('Y', classifier.eval(['Chicago', 85, 'F']))
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_get_rules
|
71
|
+
classifier = Hyperpipes.new.build(@data_set)
|
72
|
+
age = 28
|
73
|
+
gender = "M"
|
74
|
+
marketing_target = nil
|
75
|
+
eval classifier.get_rules
|
76
|
+
assert_equal 'Y', marketing_target
|
77
|
+
age = 44
|
78
|
+
city='New York'
|
79
|
+
eval classifier.get_rules
|
80
|
+
assert_equal 'N', marketing_target
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
@@ -1,69 +1,69 @@
|
|
1
|
-
# Author:: Sergio Fierens (implementation)
|
2
|
-
# License:: MPL 1.1
|
3
|
-
# Project:: ai4r
|
4
|
-
# Url:: http://ai4r.rubyforge.org/
|
5
|
-
#
|
6
|
-
# You can redistribute it and/or modify it under the terms of
|
7
|
-
# the Mozilla Public License version 1.1 as published by the
|
8
|
-
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
|
9
|
-
|
10
|
-
require 'test/unit'
|
11
|
-
require File.dirname(__FILE__) + '/../../lib/ai4r/clusterers/diana'
|
12
|
-
|
13
|
-
class Ai4r::Clusterers::Diana
|
14
|
-
attr_accessor :data_set, :number_of_clusters, :clusters
|
15
|
-
end
|
16
|
-
|
17
|
-
class DianaTest < Test::Unit::TestCase
|
18
|
-
|
19
|
-
@@data = [ [10, 3], [3, 10], [2, 8], [2, 5], [3, 8], [10, 3],
|
20
|
-
[1, 3], [8, 1], [2, 9], [2, 5], [3, 3], [9, 4]]
|
21
|
-
|
22
|
-
include Ai4r::Clusterers
|
23
|
-
include Ai4r::Data
|
24
|
-
|
25
|
-
def setup
|
26
|
-
Diana.send(:public, *Diana.protected_instance_methods)
|
27
|
-
@data_set = DataSet.new(:data_items => @@data.clone)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_build
|
31
|
-
clusterer = Diana.new.build(@data_set, 4)
|
32
|
-
assert_equal 4, clusterer.clusters.length
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_eval
|
36
|
-
clusterer = Diana.new.build(@data_set, 4)
|
37
|
-
assert_equal 0, clusterer.eval([0, 0])
|
38
|
-
assert_equal 1, clusterer.eval([9, 3])
|
39
|
-
assert_equal 2, clusterer.eval([0,10])
|
40
|
-
assert_equal 3, clusterer.eval([8, 0])
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_cluster_diameter
|
44
|
-
clusterer = Diana.new
|
45
|
-
assert_equal 106, clusterer.cluster_diameter(@data_set)
|
46
|
-
assert_equal 98, clusterer.cluster_diameter(@data_set[0..2])
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_max_diameter_cluster
|
50
|
-
clusterer = Diana.new
|
51
|
-
assert_equal 0, clusterer.max_diameter_cluster([@data_set, @data_set[0..2]])
|
52
|
-
assert_equal 1, clusterer.max_diameter_cluster([@data_set[0..2], @data_set])
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_init_splinter_cluster
|
56
|
-
clusterer = Diana.new
|
57
|
-
assert_equal [10,3], clusterer.
|
58
|
-
init_splinter_cluster(@data_set).data_items[0]
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_max_distance_difference
|
62
|
-
clusterer = Diana.new
|
63
|
-
data_set_a = @data_set[1..-1]
|
64
|
-
data_set_b = @data_set[0]
|
65
|
-
assert_equal [63.7, 4], clusterer.
|
66
|
-
max_distance_difference(data_set_a, data_set_b)
|
67
|
-
end
|
68
|
-
|
1
|
+
# Author:: Sergio Fierens (implementation)
|
2
|
+
# License:: MPL 1.1
|
3
|
+
# Project:: ai4r
|
4
|
+
# Url:: http://ai4r.rubyforge.org/
|
5
|
+
#
|
6
|
+
# You can redistribute it and/or modify it under the terms of
|
7
|
+
# the Mozilla Public License version 1.1 as published by the
|
8
|
+
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
require File.dirname(__FILE__) + '/../../lib/ai4r/clusterers/diana'
|
12
|
+
|
13
|
+
class Ai4r::Clusterers::Diana
|
14
|
+
attr_accessor :data_set, :number_of_clusters, :clusters
|
15
|
+
end
|
16
|
+
|
17
|
+
class DianaTest < Test::Unit::TestCase
|
18
|
+
|
19
|
+
@@data = [ [10, 3], [3, 10], [2, 8], [2, 5], [3, 8], [10, 3],
|
20
|
+
[1, 3], [8, 1], [2, 9], [2, 5], [3, 3], [9, 4]]
|
21
|
+
|
22
|
+
include Ai4r::Clusterers
|
23
|
+
include Ai4r::Data
|
24
|
+
|
25
|
+
def setup
|
26
|
+
Diana.send(:public, *Diana.protected_instance_methods)
|
27
|
+
@data_set = DataSet.new(:data_items => @@data.clone)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_build
|
31
|
+
clusterer = Diana.new.build(@data_set, 4)
|
32
|
+
assert_equal 4, clusterer.clusters.length
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_eval
|
36
|
+
clusterer = Diana.new.build(@data_set, 4)
|
37
|
+
assert_equal 0, clusterer.eval([0, 0])
|
38
|
+
assert_equal 1, clusterer.eval([9, 3])
|
39
|
+
assert_equal 2, clusterer.eval([0,10])
|
40
|
+
assert_equal 3, clusterer.eval([8, 0])
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_cluster_diameter
|
44
|
+
clusterer = Diana.new
|
45
|
+
assert_equal 106, clusterer.cluster_diameter(@data_set)
|
46
|
+
assert_equal 98, clusterer.cluster_diameter(@data_set[0..2])
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_max_diameter_cluster
|
50
|
+
clusterer = Diana.new
|
51
|
+
assert_equal 0, clusterer.max_diameter_cluster([@data_set, @data_set[0..2]])
|
52
|
+
assert_equal 1, clusterer.max_diameter_cluster([@data_set[0..2], @data_set])
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_init_splinter_cluster
|
56
|
+
clusterer = Diana.new
|
57
|
+
assert_equal [10,3], clusterer.
|
58
|
+
init_splinter_cluster(@data_set).data_items[0]
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_max_distance_difference
|
62
|
+
clusterer = Diana.new
|
63
|
+
data_set_a = @data_set[1..-1]
|
64
|
+
data_set_b = @data_set[0]
|
65
|
+
assert_equal [63.7, 4], clusterer.
|
66
|
+
max_distance_difference(data_set_a, data_set_b)
|
67
|
+
end
|
68
|
+
|
69
69
|
end
|
data/test/data/data_set_test.rb
CHANGED
@@ -23,19 +23,21 @@ module Ai4r
|
|
23
23
|
def test_build_domains
|
24
24
|
domains = [ Set.new(["New York", "Chicago"]),
|
25
25
|
Set.new(["M", "F"]),
|
26
|
+
[5, 85],
|
26
27
|
Set.new(["Y", "N"]) ]
|
27
|
-
data = [ [ "New York", "M", "Y"],
|
28
|
-
[ "Chicago", "M", "Y"],
|
29
|
-
[ "New York", "F", "Y"],
|
30
|
-
[ "New York", "M", "N"],
|
31
|
-
[ "Chicago", "M", "N"],
|
32
|
-
[ "Chicago", "F", "Y"] ]
|
33
|
-
labels = ["city", "gender", "result"]
|
28
|
+
data = [ [ "New York", "M", 23, "Y"],
|
29
|
+
[ "Chicago", "M", 85, "Y"],
|
30
|
+
[ "New York", "F", 32, "Y"],
|
31
|
+
[ "New York", "M", 5, "N"],
|
32
|
+
[ "Chicago", "M", 15, "N"],
|
33
|
+
[ "Chicago", "F", 45, "Y"] ]
|
34
|
+
labels = ["city", "gender", "age", "result"]
|
34
35
|
set = DataSet.new({:data_items => data, :data_labels => labels})
|
35
36
|
assert_equal domains, set.build_domains
|
36
37
|
assert_equal domains[0], set.build_domain("city")
|
37
38
|
assert_equal domains[1], set.build_domain(1)
|
38
|
-
assert_equal domains[2], set.build_domain("
|
39
|
+
assert_equal domains[2], set.build_domain("age")
|
40
|
+
assert_equal domains[3], set.build_domain("result")
|
39
41
|
end
|
40
42
|
|
41
43
|
def test_set_data_labels
|
metadata
CHANGED
@@ -1,116 +1,123 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: ai4r
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2009-04-08 00:00:00 +01:00
|
8
|
-
summary: Ruby implementations of algorithms covering several Artificial intelligence fields, including Genetic algorithms, Neural Networks, machine learning, and clustering.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: sergio@jadeferret.com
|
12
|
-
homepage: http://ai4r.rubyforge.org
|
13
|
-
rubyforge_project: ai4r
|
14
|
-
description:
|
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:
|
4
|
+
version: 1.6.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Sergio Fierens
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-09 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: sergio@jadeferret.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
31
24
|
files:
|
32
25
|
- examples/clusterers
|
33
26
|
- examples/clusterers/simple_website_clustering.rb
|
27
|
+
- examples/neural_network
|
28
|
+
- examples/neural_network/backpropagation_example.rb
|
29
|
+
- examples/neural_network/patterns_with_base_noise.rb
|
30
|
+
- examples/neural_network/xor_example.rb
|
31
|
+
- examples/neural_network/patterns_with_noise.rb
|
32
|
+
- examples/neural_network/training_patterns.rb
|
34
33
|
- examples/decision_trees
|
35
34
|
- examples/decision_trees/data_set.csv
|
36
|
-
- examples/decision_trees/id3_example.rb
|
37
35
|
- examples/decision_trees/results.txt
|
36
|
+
- examples/decision_trees/id3_example.rb
|
38
37
|
- examples/genetic_algorithm
|
39
38
|
- examples/genetic_algorithm/genetic_algorithm_example.rb
|
40
39
|
- examples/genetic_algorithm/travel_cost.csv
|
41
|
-
-
|
42
|
-
- examples/neural_network/backpropagation_example.rb
|
43
|
-
- examples/neural_network/patterns_with_base_noise.rb
|
44
|
-
- examples/neural_network/patterns_with_noise.rb
|
45
|
-
- examples/neural_network/training_patterns.rb
|
46
|
-
- examples/neural_network/xor_example.rb
|
40
|
+
- lib/ai4r.rb
|
47
41
|
- lib/ai4r
|
48
|
-
- lib/ai4r/classifiers
|
49
|
-
- lib/ai4r/classifiers/classifier.rb
|
50
|
-
- lib/ai4r/classifiers/hyperpipes.rb
|
51
|
-
- lib/ai4r/classifiers/id3.rb
|
52
|
-
- lib/ai4r/classifiers/multilayer_perceptron.rb
|
53
|
-
- lib/ai4r/classifiers/one_r.rb
|
54
|
-
- lib/ai4r/classifiers/prism.rb
|
55
|
-
- lib/ai4r/classifiers/zero_r.rb
|
56
42
|
- lib/ai4r/clusterers
|
57
43
|
- lib/ai4r/clusterers/average_linkage.rb
|
58
|
-
- lib/ai4r/clusterers/
|
44
|
+
- lib/ai4r/clusterers/median_linkage.rb
|
59
45
|
- lib/ai4r/clusterers/centroid_linkage.rb
|
60
|
-
- lib/ai4r/clusterers/
|
46
|
+
- lib/ai4r/clusterers/weighted_average_linkage.rb
|
61
47
|
- lib/ai4r/clusterers/complete_linkage.rb
|
62
48
|
- lib/ai4r/clusterers/diana.rb
|
63
|
-
- lib/ai4r/clusterers/
|
64
|
-
- lib/ai4r/clusterers/median_linkage.rb
|
65
|
-
- lib/ai4r/clusterers/single_linkage.rb
|
49
|
+
- lib/ai4r/clusterers/bisecting_k_means.rb
|
66
50
|
- lib/ai4r/clusterers/ward_linkage.rb
|
67
|
-
- lib/ai4r/clusterers/
|
68
|
-
- lib/ai4r/
|
69
|
-
- lib/ai4r/
|
70
|
-
- lib/ai4r/data/data_set.rb
|
71
|
-
- lib/ai4r/data/parameterizable.rb
|
72
|
-
- lib/ai4r/data/proximity.rb
|
73
|
-
- lib/ai4r/data/statistics.rb
|
51
|
+
- lib/ai4r/clusterers/single_linkage.rb
|
52
|
+
- lib/ai4r/clusterers/k_means.rb
|
53
|
+
- lib/ai4r/clusterers/clusterer.rb
|
74
54
|
- lib/ai4r/experiment
|
75
55
|
- lib/ai4r/experiment/classifier_evaluator.rb
|
76
|
-
- lib/ai4r/genetic_algorithm
|
77
|
-
- lib/ai4r/genetic_algorithm/genetic_algorithm.rb
|
78
56
|
- lib/ai4r/neural_network
|
79
57
|
- lib/ai4r/neural_network/backpropagation.rb
|
80
|
-
- lib/ai4r
|
58
|
+
- lib/ai4r/classifiers
|
59
|
+
- lib/ai4r/classifiers/hyperpipes.rb
|
60
|
+
- lib/ai4r/classifiers/multilayer_perceptron.rb
|
61
|
+
- lib/ai4r/classifiers/prism.rb
|
62
|
+
- lib/ai4r/classifiers/one_r.rb
|
63
|
+
- lib/ai4r/classifiers/zero_r.rb
|
64
|
+
- lib/ai4r/classifiers/classifier.rb
|
65
|
+
- lib/ai4r/classifiers/id3.rb
|
66
|
+
- lib/ai4r/genetic_algorithm
|
67
|
+
- lib/ai4r/genetic_algorithm/genetic_algorithm.rb
|
68
|
+
- lib/ai4r/data
|
69
|
+
- lib/ai4r/data/parameterizable.rb
|
70
|
+
- lib/ai4r/data/statistics.rb
|
71
|
+
- lib/ai4r/data/data_set.rb
|
72
|
+
- lib/ai4r/data/proximity.rb
|
81
73
|
- README.rdoc
|
74
|
+
has_rdoc: true
|
75
|
+
homepage: http://ai4r.rubyforge.org
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: ai4r
|
96
|
+
rubygems_version: 1.3.1
|
97
|
+
signing_key:
|
98
|
+
specification_version: 2
|
99
|
+
summary: Ruby implementations of algorithms covering several Artificial intelligence fields, including Genetic algorithms, Neural Networks, machine learning, and clustering.
|
82
100
|
test_files:
|
83
|
-
- test/
|
84
|
-
- test/
|
85
|
-
- test/classifiers/one_r_test.rb
|
86
|
-
- test/classifiers/prism_test.rb
|
87
|
-
- test/classifiers/zero_r_test.rb
|
88
|
-
- test/clusterers/average_linkage_test.rb
|
89
|
-
- test/clusterers/bisecting_k_means_test.rb
|
90
|
-
- test/clusterers/centroid_linkage_test.rb
|
91
|
-
- test/clusterers/complete_linkage_test.rb
|
101
|
+
- test/clusterers/single_linkage_test.rb
|
102
|
+
- test/clusterers/weighted_average_linkage_test.rb
|
92
103
|
- test/clusterers/diana_test.rb
|
93
|
-
- test/clusterers/
|
104
|
+
- test/clusterers/average_linkage_test.rb
|
94
105
|
- test/clusterers/median_linkage_test.rb
|
95
|
-
- test/clusterers/single_linkage_test.rb
|
96
106
|
- test/clusterers/ward_linkage_test.rb
|
97
|
-
- test/clusterers/
|
98
|
-
- test/
|
99
|
-
- test/
|
100
|
-
- test/
|
107
|
+
- test/clusterers/complete_linkage_test.rb
|
108
|
+
- test/clusterers/centroid_linkage_test.rb
|
109
|
+
- test/clusterers/k_means_test.rb
|
110
|
+
- test/clusterers/bisecting_k_means_test.rb
|
101
111
|
- test/experiment/classifier_evaluator_test.rb
|
102
|
-
- test/genetic_algorithm/chromosome_test.rb
|
103
|
-
- test/genetic_algorithm/genetic_algorithm_test.rb
|
104
112
|
- test/neural_network/backpropagation_test.rb
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
- test/classifiers/zero_r_test.rb
|
114
|
+
- test/classifiers/multilayer_perceptron_test.rb
|
115
|
+
- test/classifiers/prism_test.rb
|
116
|
+
- test/classifiers/one_r_test.rb
|
117
|
+
- test/classifiers/hyperpipes_test.rb
|
118
|
+
- test/classifiers/id3_test.rb
|
119
|
+
- test/genetic_algorithm/genetic_algorithm_test.rb
|
120
|
+
- test/genetic_algorithm/chromosome_test.rb
|
121
|
+
- test/data/statistics_test.rb
|
122
|
+
- test/data/proximity_test.rb
|
123
|
+
- test/data/data_set_test.rb
|
data/lib/ai4r/data/constants.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Author:: Sergio Fierens
|
2
|
-
# License:: MPL 1.1
|
3
|
-
# Project:: ai4r
|
4
|
-
# Url:: http://ai4r.rubyforge.org/
|
5
|
-
#
|
6
|
-
# You can redistribute it and/or modify it under the terms of
|
7
|
-
# the Mozilla Public License version 1.1 as published by the
|
8
|
-
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
|
9
|
-
|
10
|
-
module Ai4r
|
11
|
-
module Data
|
12
|
-
|
13
|
-
POSITIVE_INFINTY = 1.0/0
|
14
|
-
|
15
|
-
NEGATIVE_INFINTY = -1.0/0
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|