ai4r 1.1 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/README.rdoc +21 -20
  2. data/examples/decision_trees/id3_example.rb +3 -2
  3. data/examples/genetic_algorithm/genetic_algorithm_example.rb +6 -6
  4. data/examples/neural_network/backpropagation_example.rb +2 -2
  5. data/lib/ai4r/classifiers/classifier_helper.rb +54 -0
  6. data/lib/ai4r/classifiers/id3.rb +356 -0
  7. data/lib/ai4r/classifiers/one_r.rb +148 -0
  8. data/lib/ai4r/classifiers/prism.rb +231 -0
  9. data/lib/ai4r/classifiers/zero_r.rb +104 -0
  10. data/lib/ai4r/genetic_algorithm/genetic_algorithm.rb +272 -0
  11. data/lib/ai4r/neural_network/backpropagation.rb +271 -0
  12. data/site/build/tmp/locationmap.xml +14 -14
  13. data/site/build/tmp/output.xmap +23 -23
  14. data/site/build/tmp/pluginlist2fetchbuild.xml +144 -144
  15. data/site/build/tmp/plugins-1.xml +0 -11
  16. data/site/build/tmp/plugins-2.xml +54 -0
  17. data/site/build/tmp/projfilters.properties +41 -41
  18. data/site/build/webapp/WEB-INF/logs/core.log +681 -788
  19. data/site/build/webapp/WEB-INF/logs/error.log +281 -248
  20. data/site/build/webapp/WEB-INF/logs/sitemap.log +1015 -0
  21. data/site/src/documentation/content/xdocs/forum.html +9 -0
  22. data/site/src/documentation/content/xdocs/geneticAlgorithms.xml +82 -68
  23. data/site/src/documentation/content/xdocs/index.xml +47 -18
  24. data/site/src/documentation/content/xdocs/machineLearning.xml +10 -9
  25. data/site/src/documentation/content/xdocs/neuralNetworks.xml +60 -36
  26. data/site/src/documentation/content/xdocs/site.xml +8 -5
  27. data/site/src/documentation/content/xdocs/svn.xml +11 -1
  28. data/site/src/documentation/resources/images/Thumbs.db +0 -0
  29. data/site/src/documentation/resources/images/ai4r-logo.png +0 -0
  30. data/site/src/documentation/resources/images/genetic_algorithms_example.png +0 -0
  31. data/site/src/documentation/resources/images/jadeferret.png +0 -0
  32. data/site/src/documentation/resources/images/neural_network_example.png +0 -0
  33. data/site/src/documentation/resources/images/sub-dir/Thumbs.db +0 -0
  34. data/site/src/documentation/skinconf.xml +18 -18
  35. data/test/classifiers/id3_test.rb +206 -0
  36. data/test/classifiers/one_r_test.rb +62 -0
  37. data/test/classifiers/prism_test.rb +83 -0
  38. data/test/classifiers/zero_r_test.rb +48 -0
  39. data/test/genetic_algorithm/chromosome_test.rb +41 -38
  40. data/test/genetic_algorithm/genetic_algorithm_test.rb +64 -61
  41. data/test/neural_network/backpropagation_test.rb +20 -18
  42. metadata +109 -199
  43. data/lib/decision_tree/id3.rb +0 -354
  44. data/lib/genetic_algorithm/genetic_algorithm.rb +0 -268
  45. data/lib/neural_network/backpropagation.rb +0 -264
  46. data/site/build/site/en/broken-links.xml +0 -2
  47. data/site/build/site/en/downloads.html +0 -187
  48. data/site/build/site/en/downloads.pdf +0 -151
  49. data/site/build/site/en/geneticAlgorithms.html +0 -564
  50. data/site/build/site/en/geneticAlgorithms.pdf +0 -911
  51. data/site/build/site/en/images/ai4r-logo.png +0 -0
  52. data/site/build/site/en/images/built-with-forrest-button.png +0 -0
  53. data/site/build/site/en/images/c.png +0 -0
  54. data/site/build/site/en/images/c_wbn.png +0 -0
  55. data/site/build/site/en/images/c_wn.png +0 -0
  56. data/site/build/site/en/images/ero.gif +0 -0
  57. data/site/build/site/en/images/europe2.png +0 -0
  58. data/site/build/site/en/images/europe3.png +0 -0
  59. data/site/build/site/en/images/fitness.png +0 -0
  60. data/site/build/site/en/images/instruction_arrow.png +0 -0
  61. data/site/build/site/en/images/my_email.png +0 -0
  62. data/site/build/site/en/images/rubyforge.png +0 -0
  63. data/site/build/site/en/images/s.png +0 -0
  64. data/site/build/site/en/images/s_wbn.png +0 -0
  65. data/site/build/site/en/images/s_wn.png +0 -0
  66. data/site/build/site/en/images/sigmoid.png +0 -0
  67. data/site/build/site/en/images/t.png +0 -0
  68. data/site/build/site/en/images/t_wbn.png +0 -0
  69. data/site/build/site/en/images/t_wn.png +0 -0
  70. data/site/build/site/en/index.html +0 -258
  71. data/site/build/site/en/index.pdf +0 -306
  72. data/site/build/site/en/linkmap.html +0 -231
  73. data/site/build/site/en/linkmap.pdf +0 -94
  74. data/site/build/site/en/locationmap.xml +0 -72
  75. data/site/build/site/en/machineLearning.html +0 -325
  76. data/site/build/site/en/machineLearning.pdf +0 -337
  77. data/site/build/site/en/neuralNetworks.html +0 -446
  78. data/site/build/site/en/neuralNetworks.pdf +0 -604
  79. data/site/build/site/en/skin/CommonMessages_de.xml +0 -23
  80. data/site/build/site/en/skin/CommonMessages_en_US.xml +0 -23
  81. data/site/build/site/en/skin/CommonMessages_es.xml +0 -23
  82. data/site/build/site/en/skin/CommonMessages_fr.xml +0 -23
  83. data/site/build/site/en/skin/basic.css +0 -166
  84. data/site/build/site/en/skin/breadcrumbs-optimized.js +0 -90
  85. data/site/build/site/en/skin/breadcrumbs.js +0 -237
  86. data/site/build/site/en/skin/fontsize.js +0 -166
  87. data/site/build/site/en/skin/getBlank.js +0 -40
  88. data/site/build/site/en/skin/getMenu.js +0 -45
  89. data/site/build/site/en/skin/images/README.txt +0 -1
  90. data/site/build/site/en/skin/images/add.jpg +0 -0
  91. data/site/build/site/en/skin/images/built-with-forrest-button.png +0 -0
  92. data/site/build/site/en/skin/images/chapter.gif +0 -0
  93. data/site/build/site/en/skin/images/chapter_open.gif +0 -0
  94. data/site/build/site/en/skin/images/current.gif +0 -0
  95. data/site/build/site/en/skin/images/error.png +0 -0
  96. data/site/build/site/en/skin/images/external-link.gif +0 -0
  97. data/site/build/site/en/skin/images/fix.jpg +0 -0
  98. data/site/build/site/en/skin/images/forrest-credit-logo.png +0 -0
  99. data/site/build/site/en/skin/images/hack.jpg +0 -0
  100. data/site/build/site/en/skin/images/header_white_line.gif +0 -0
  101. data/site/build/site/en/skin/images/info.png +0 -0
  102. data/site/build/site/en/skin/images/instruction_arrow.png +0 -0
  103. data/site/build/site/en/skin/images/label.gif +0 -0
  104. data/site/build/site/en/skin/images/page.gif +0 -0
  105. data/site/build/site/en/skin/images/pdfdoc.gif +0 -0
  106. data/site/build/site/en/skin/images/poddoc.png +0 -0
  107. data/site/build/site/en/skin/images/printer.gif +0 -0
  108. data/site/build/site/en/skin/images/rc-b-l-15-1body-2menu-3menu.png +0 -0
  109. data/site/build/site/en/skin/images/rc-b-r-15-1body-2menu-3menu.png +0 -0
  110. data/site/build/site/en/skin/images/rc-b-r-5-1header-2tab-selected-3tab-selected.png +0 -0
  111. data/site/build/site/en/skin/images/rc-t-l-5-1header-2searchbox-3searchbox.png +0 -0
  112. data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-selected-3tab-selected.png +0 -0
  113. data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png +0 -0
  114. data/site/build/site/en/skin/images/rc-t-r-15-1body-2menu-3menu.png +0 -0
  115. data/site/build/site/en/skin/images/rc-t-r-5-1header-2searchbox-3searchbox.png +0 -0
  116. data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-selected-3tab-selected.png +0 -0
  117. data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png +0 -0
  118. data/site/build/site/en/skin/images/remove.jpg +0 -0
  119. data/site/build/site/en/skin/images/rss.png +0 -0
  120. data/site/build/site/en/skin/images/spacer.gif +0 -0
  121. data/site/build/site/en/skin/images/success.png +0 -0
  122. data/site/build/site/en/skin/images/txtdoc.png +0 -0
  123. data/site/build/site/en/skin/images/update.jpg +0 -0
  124. data/site/build/site/en/skin/images/valid-html401.png +0 -0
  125. data/site/build/site/en/skin/images/vcss.png +0 -0
  126. data/site/build/site/en/skin/images/warning.png +0 -0
  127. data/site/build/site/en/skin/images/xmldoc.gif +0 -0
  128. data/site/build/site/en/skin/menu.js +0 -48
  129. data/site/build/site/en/skin/note.txt +0 -50
  130. data/site/build/site/en/skin/print.css +0 -54
  131. data/site/build/site/en/skin/profile.css +0 -163
  132. data/site/build/site/en/skin/prototype.js +0 -1257
  133. data/site/build/site/en/skin/screen.css +0 -587
  134. data/site/build/site/en/svn.html +0 -223
  135. data/site/build/site/en/svn.pdf +0 -239
  136. data/site/build/site/en/wholesite.pdf +0 -1686
  137. data/site/build/tmp/brokenlinks.xml +0 -2
  138. data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.data +0 -0
  139. data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.index +0 -0
  140. data/test/decision_tree/id3_test.rb +0 -209
@@ -0,0 +1,48 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
2
+
3
+ require 'test/unit'
4
+ require File.dirname(__FILE__) + '/../../lib/ai4r/classifiers/zero_r'
5
+
6
+ class ZeroRTest < Test::Unit::TestCase
7
+
8
+ include Ai4r::Classifiers
9
+
10
+ @@data_examples = [ ['New York', '<30', 'M', 'Y'],
11
+ ['Chicago', '<30', 'M', 'Y'],
12
+ ['New York', '<30', 'M', 'Y'],
13
+ ['New York', '[30-50)', 'F', 'N'],
14
+ ['Chicago', '[30-50)', 'F', 'Y'],
15
+ ['New York', '[30-50)', 'F', 'N'],
16
+ ['Chicago', '[50-80]', 'M', 'N'],
17
+ ]
18
+
19
+ @@data_labels = [ 'city', 'age_range', 'gender', 'marketing_target' ]
20
+
21
+ def test_build
22
+ assert_raise(ArgumentError) { ZeroR.new.build(nil) }
23
+ assert_raise(ArgumentError) { ZeroR.new.build([]) }
24
+ classifier = ZeroR.new.build(@@data_examples)
25
+ assert_equal("Y", classifier.class_value)
26
+ assert_equal("attribute_1", classifier.data_labels.first)
27
+ assert_equal("class_value", classifier.data_labels.last)
28
+ classifier = ZeroR.new.build(@@data_examples, @@data_labels)
29
+ assert_equal("Y", classifier.class_value)
30
+ assert_equal("city", classifier.data_labels.first)
31
+ assert_equal("marketing_target", classifier.data_labels.last)
32
+ end
33
+
34
+ def test_eval
35
+ classifier = ZeroR.new.build(@@data_examples)
36
+ assert_equal('Y', classifier.eval(@@data_examples.first) )
37
+ assert_equal('Y', classifier.eval(@@data_examples.last) )
38
+ end
39
+
40
+ def test_to_s
41
+ classifier = ZeroR.new.build(@@data_examples, @@data_labels)
42
+ marketing_target = nil
43
+ eval(classifier.to_s)
44
+ assert_equal('Y', marketing_target)
45
+ end
46
+
47
+ end
48
+
@@ -8,48 +8,51 @@
8
8
  # Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
9
9
 
10
10
 
11
- require File.dirname(__FILE__) + '/../../lib/genetic_algorithm/genetic_algorithm'
11
+ require File.dirname(__FILE__) + '/../../lib/ai4r/genetic_algorithm/genetic_algorithm'
12
12
 
13
13
  require 'test/unit'
14
14
 
15
- module GeneticAlgorithm
15
+ module Ai4r
16
16
 
17
- COST = [
18
- [ 0, 10, 12, 21, 25, 25, 34, 26, 28, 11],
19
- [ 10, 0, 12, 21, 19, 21, 18, 12, 22, 11],
20
- [ 10, 12, 0, 24, 18, 16, 36, 29, 17, 22],
21
- [ 20, 12, 22, 0, 32, 34, 28, 24, 31, 9],
22
- [ 23, 20, 19, 31, 0, 25, 29, 25, 31, 28],
23
- [ 24, 20, 15, 33, 24, 0, 38, 34, 17, 25],
24
- [ 33, 19, 35, 29, 24, 34, 0, 9, 38, 28],
25
- [ 25, 13, 28, 25, 25, 34, 9, 0, 33, 19],
26
- [ 30, 23, 18, 29, 31, 18, 38, 34, 0, 23],
27
- [ 11, 11, 22, 9, 28, 26, 27, 19, 22, 0]
28
- ]
29
-
30
- class ChromosomeTest < Test::Unit::TestCase
31
-
32
- def test_chromosome_seed
33
- Chromosome.set_cost_matrix(COST)
34
- chromosome = Chromosome.seed
35
- assert_equal [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], chromosome.data.sort
36
- end
37
-
38
- def test_fitness
39
- Chromosome.set_cost_matrix(COST)
40
- chromosome = Chromosome.new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
41
- assert_equal( -206, chromosome.fitness)
42
- end
43
-
44
- def test_reproduce
45
- Chromosome.set_cost_matrix(COST)
46
- c1 = Chromosome.new([2, 8, 5, 3, 6, 7, 1, 9, 0, 4])
47
- c2 = Chromosome.new([3, 2, 0, 1, 5, 4, 6, 7, 9, 8])
48
- c3 = Chromosome.reproduce(c1, c2)
49
- assert_equal([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], c3.data.sort)
17
+ module GeneticAlgorithm
18
+
19
+ COST = [
20
+ [ 0, 10, 12, 21, 25, 25, 34, 26, 28, 11],
21
+ [ 10, 0, 12, 21, 19, 21, 18, 12, 22, 11],
22
+ [ 10, 12, 0, 24, 18, 16, 36, 29, 17, 22],
23
+ [ 20, 12, 22, 0, 32, 34, 28, 24, 31, 9],
24
+ [ 23, 20, 19, 31, 0, 25, 29, 25, 31, 28],
25
+ [ 24, 20, 15, 33, 24, 0, 38, 34, 17, 25],
26
+ [ 33, 19, 35, 29, 24, 34, 0, 9, 38, 28],
27
+ [ 25, 13, 28, 25, 25, 34, 9, 0, 33, 19],
28
+ [ 30, 23, 18, 29, 31, 18, 38, 34, 0, 23],
29
+ [ 11, 11, 22, 9, 28, 26, 27, 19, 22, 0]
30
+ ]
31
+
32
+ class ChromosomeTest < Test::Unit::TestCase
33
+
34
+ def test_chromosome_seed
35
+ Chromosome.set_cost_matrix(COST)
36
+ chromosome = Chromosome.seed
37
+ assert_equal [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], chromosome.data.sort
38
+ end
39
+
40
+ def test_fitness
41
+ Chromosome.set_cost_matrix(COST)
42
+ chromosome = Chromosome.new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
43
+ assert_equal( -206, chromosome.fitness)
44
+ end
45
+
46
+ def test_reproduce
47
+ Chromosome.set_cost_matrix(COST)
48
+ c1 = Chromosome.new([2, 8, 5, 3, 6, 7, 1, 9, 0, 4])
49
+ c2 = Chromosome.new([3, 2, 0, 1, 5, 4, 6, 7, 9, 8])
50
+ c3 = Chromosome.reproduce(c1, c2)
51
+ assert_equal([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], c3.data.sort)
52
+ end
53
+
50
54
  end
51
-
52
- end
53
55
 
56
+ end
54
57
 
55
- end
58
+ end
@@ -7,72 +7,75 @@
7
7
  # the Mozilla Public License version 1.1 as published by the
8
8
  # Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
9
9
 
10
- require File.dirname(__FILE__) + '/../../lib/genetic_algorithm/genetic_algorithm'
10
+ require File.dirname(__FILE__) + '/../../lib/ai4r/genetic_algorithm/genetic_algorithm'
11
11
  require 'test/unit'
12
12
 
13
- module GeneticAlgorithm
13
+ module Ai4r
14
14
 
15
- COUNTRY = %w"Belgium France Germany Ireland Italy Poland Portugal Spain Sweden UK"
16
-
17
- # Belgium, France, Germany, Ireland, Italy, Poland, Portugal, Spain, Sweden, UK
18
- COSTS = [
19
- [ 0, 10, 12, 21, 25, 25, 34, 26, 28, 11],
20
- [ 10, 0, 12, 21, 19, 21, 18, 12, 22, 11],
21
- [ 10, 12, 0, 24, 18, 16, 36, 29, 17, 22],
22
- [ 20, 12, 22, 0, 32, 34, 28, 24, 31, 9],
23
- [ 23, 20, 19, 31, 0, 25, 29, 25, 31, 28],
24
- [ 24, 20, 15, 33, 24, 0, 38, 34, 17, 25],
25
- [ 33, 19, 35, 29, 24, 34, 0, 9, 38, 28],
26
- [ 25, 13, 28, 25, 25, 34, 9, 0, 33, 19],
27
- [ 30, 23, 18, 29, 31, 18, 38, 34, 0, 23],
28
- [ 11, 11, 22, 9, 28, 26, 27, 19, 22, 0]
29
- ]
15
+ module GeneticAlgorithm
16
+
17
+ COUNTRY = %w"Belgium France Germany Ireland Italy Poland Portugal Spain Sweden UK"
18
+
19
+ # Belgium, France, Germany, Ireland, Italy, Poland, Portugal, Spain, Sweden, UK
20
+ COSTS = [
21
+ [ 0, 10, 12, 21, 25, 25, 34, 26, 28, 11],
22
+ [ 10, 0, 12, 21, 19, 21, 18, 12, 22, 11],
23
+ [ 10, 12, 0, 24, 18, 16, 36, 29, 17, 22],
24
+ [ 20, 12, 22, 0, 32, 34, 28, 24, 31, 9],
25
+ [ 23, 20, 19, 31, 0, 25, 29, 25, 31, 28],
26
+ [ 24, 20, 15, 33, 24, 0, 38, 34, 17, 25],
27
+ [ 33, 19, 35, 29, 24, 34, 0, 9, 38, 28],
28
+ [ 25, 13, 28, 25, 25, 34, 9, 0, 33, 19],
29
+ [ 30, 23, 18, 29, 31, 18, 38, 34, 0, 23],
30
+ [ 11, 11, 22, 9, 28, 26, 27, 19, 22, 0]
31
+ ]
32
+
33
+
34
+ class GeneticAlgorithmTest < Test::Unit::TestCase
35
+
36
+ def test_chromosome_seed
37
+ Chromosome.set_cost_matrix(COSTS)
38
+ chromosome = Chromosome.seed
39
+ assert_equal [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], chromosome.data.sort
40
+ end
41
+
42
+ def test_fitness
43
+ Chromosome.set_cost_matrix(COSTS)
44
+ chromosome = Chromosome.new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
45
+ assert_equal( -206, chromosome.fitness)
46
+ end
47
+
48
+ def test_selection
49
+ search = GeneticSearch.new(10, 5)
50
+ search.generate_initial_population
51
+ selected = search.selection
52
+ selected.each { |c| assert c!=nil }
53
+ assert_equal 6, selected.length
54
+ assert_equal 1, search.population[0].normalized_fitness
55
+ assert_equal 0, search.population.last.normalized_fitness
56
+ assert_equal 10, search.population.length
57
+ end
58
+
59
+ def test_reproduction
60
+ search = GeneticSearch.new(10, 5)
61
+ search.generate_initial_population
62
+ selected = search.selection
63
+ offsprings = search.reproduction selected
64
+ assert_equal 3, offsprings.length
65
+ end
66
+
67
+ def test_replace_worst_ranked
68
+ search = GeneticSearch.new(10, 5)
69
+ search.generate_initial_population
70
+ selected = search.selection
71
+ offsprings = search.reproduction selected
72
+ search.replace_worst_ranked offsprings
73
+ assert_equal 10, search.population.length
74
+ offsprings.each { |c| assert search.population.include?(c)}
75
+ end
30
76
 
31
-
32
- class GeneticAlgorithmTest < Test::Unit::TestCase
33
-
34
- def test_chromosome_seed
35
- Chromosome.set_cost_matrix(COSTS)
36
- chromosome = Chromosome.seed
37
- assert_equal [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], chromosome.data.sort
38
- end
39
-
40
- def test_fitness
41
- Chromosome.set_cost_matrix(COSTS)
42
- chromosome = Chromosome.new([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
43
- assert_equal( -206, chromosome.fitness)
44
- end
45
-
46
- def test_selection
47
- search = GeneticSearch.new(10, 5)
48
- search.generate_initial_population
49
- selected = search.selection
50
- selected.each { |c| assert c!=nil }
51
- assert_equal 6, selected.length
52
- assert_equal 1, search.population[0].normalized_fitness
53
- assert_equal 0, search.population.last.normalized_fitness
54
- assert_equal 10, search.population.length
55
77
  end
56
-
57
- def test_reproduction
58
- search = GeneticSearch.new(10, 5)
59
- search.generate_initial_population
60
- selected = search.selection
61
- offsprings = search.reproduction selected
62
- assert_equal 3, offsprings.length
63
- end
64
-
65
- def test_replace_worst_ranked
66
- search = GeneticSearch.new(10, 5)
67
- search.generate_initial_population
68
- selected = search.selection
69
- offsprings = search.reproduction selected
70
- search.replace_worst_ranked offsprings
71
- assert_equal 10, search.population.length
72
- offsprings.each { |c| assert search.population.include?(c)}
73
- end
74
-
75
- end
76
78
 
79
+ end
77
80
 
78
81
  end
@@ -15,30 +15,32 @@
15
15
  #
16
16
 
17
17
 
18
- require File.dirname(__FILE__) + '/../../lib/neural_network/backpropagation'
19
-
18
+ require File.dirname(__FILE__) + '/../../lib/ai4r/neural_network/backpropagation'
20
19
  require 'test/unit'
21
20
 
22
- NeuralNetwork::Backpropagation.send(:public, *NeuralNetwork::Backpropagation.protected_instance_methods)
23
- NeuralNetwork::Backpropagation.send(:public, *NeuralNetwork::Backpropagation.private_instance_methods)
21
+ Ai4r::NeuralNetwork::Backpropagation.send(:public, *Ai4r::NeuralNetwork::Backpropagation.protected_instance_methods)
22
+ Ai4r::NeuralNetwork::Backpropagation.send(:public, *Ai4r::NeuralNetwork::Backpropagation.private_instance_methods)
24
23
 
25
- module NeuralNetwork
26
-
24
+ module Ai4r
27
25
 
28
- class BackpropagationTest < Test::Unit::TestCase
29
-
30
- def test_eval
31
- #Test set 1
32
- net = Backpropagation.new([3, 2])
33
- y = net.eval([3, 2, 3])
34
- assert y.length == 2
35
- #Test set 2
36
- net = Backpropagation.new([2, 4, 8, 10, 7])
37
- y = net.eval([2, 3])
38
- assert y.length == 7
26
+ module NeuralNetwork
27
+
28
+
29
+ class BackpropagationTest < Test::Unit::TestCase
30
+
31
+ def test_eval
32
+ #Test set 1
33
+ net = Backpropagation.new([3, 2])
34
+ y = net.eval([3, 2, 3])
35
+ assert y.length == 2
36
+ #Test set 2
37
+ net = Backpropagation.new([2, 4, 8, 10, 7])
38
+ y = net.eval([2, 3])
39
+ assert y.length == 7
40
+ end
41
+
39
42
  end
40
43
 
41
44
  end
42
45
 
43
-
44
46
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: ai4r
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.1"
7
- date: 2008-03-14 00:00:00 +00:00
6
+ version: "1.2"
7
+ date: 2009-02-14 00:00:00 +00:00
8
8
  summary: ruby implementations of algorithms covering several Artificial intelligence fields, including Genetic algorithms, Neural Networks, and machine learning.
9
9
  require_paths:
10
10
  - lib
@@ -29,237 +29,147 @@ post_install_message:
29
29
  authors:
30
30
  - Sergio Fierens
31
31
  files:
32
- - examples/neural_network
33
32
  - examples/decision_trees
33
+ - examples/decision_trees/data_set.csv
34
+ - examples/decision_trees/id3_example.rb
35
+ - examples/decision_trees/results.txt
34
36
  - examples/genetic_algorithm
37
+ - examples/genetic_algorithm/genetic_algorithm_example.rb
38
+ - examples/genetic_algorithm/travel_cost.csv
39
+ - examples/neural_network
35
40
  - examples/neural_network/backpropagation_example.rb
36
41
  - examples/neural_network/patterns_with_base_noise.rb
37
42
  - examples/neural_network/patterns_with_noise.rb
38
43
  - examples/neural_network/training_patterns.rb
39
- - examples/decision_trees/data_set.csv
40
- - examples/decision_trees/results.txt
41
- - examples/decision_trees/id3_example.rb
42
- - examples/genetic_algorithm/genetic_algorithm_example.rb
43
- - examples/genetic_algorithm/travel_cost.csv
44
- - lib/neural_network
45
- - lib/decision_tree
46
- - lib/genetic_algorithm
47
- - lib/neural_network/backpropagation.rb
48
- - lib/decision_tree/id3.rb
49
- - lib/genetic_algorithm/genetic_algorithm.rb
44
+ - lib/ai4r
45
+ - lib/ai4r/classifiers
46
+ - lib/ai4r/classifiers/classifier_helper.rb
47
+ - lib/ai4r/classifiers/id3.rb
48
+ - lib/ai4r/classifiers/one_r.rb
49
+ - lib/ai4r/classifiers/prism.rb
50
+ - lib/ai4r/classifiers/zero_r.rb
51
+ - lib/ai4r/genetic_algorithm
52
+ - lib/ai4r/genetic_algorithm/genetic_algorithm.rb
53
+ - lib/ai4r/neural_network
54
+ - lib/ai4r/neural_network/backpropagation.rb
50
55
  - site/build
51
- - site/forrest.properties
52
- - site/forrest.properties.dispatcher.properties
53
- - site/src
54
- - site/forrest.properties.xml
55
- - site/build/webapp
56
- - site/build/site
57
56
  - site/build/tmp
57
+ - site/build/tmp/build-info.xml
58
+ - site/build/tmp/input.xmap
59
+ - site/build/tmp/internal.xmap
60
+ - site/build/tmp/locationmap.xml
61
+ - site/build/tmp/output.xmap
62
+ - site/build/tmp/pluginlist2fetchbuild.xml
63
+ - site/build/tmp/plugins-1.xml
64
+ - site/build/tmp/plugins-2.xml
65
+ - site/build/tmp/projfilters.properties
66
+ - site/build/tmp/resources.xmap
67
+ - site/build/webapp
58
68
  - site/build/webapp/conf
59
69
  - site/build/webapp/WEB-INF
60
70
  - site/build/webapp/WEB-INF/logs
61
- - site/build/webapp/WEB-INF/logs/flow.log
62
- - site/build/webapp/WEB-INF/logs/locationmap.log
63
- - site/build/webapp/WEB-INF/logs/linkrewriter.log
64
- - site/build/webapp/WEB-INF/logs/error.log
65
71
  - site/build/webapp/WEB-INF/logs/access.log
66
- - site/build/webapp/WEB-INF/logs/xmlform.log
67
- - site/build/webapp/WEB-INF/logs/sitemap.log
68
72
  - site/build/webapp/WEB-INF/logs/core.log
69
- - site/build/webapp/WEB-INF/logs/idgen.log
70
73
  - site/build/webapp/WEB-INF/logs/debug.log
71
- - site/build/site/en
72
- - site/build/site/en/svn.pdf
73
- - site/build/site/en/linkmap.pdf
74
- - site/build/site/en/geneticAlgorithms.html
75
- - site/build/site/en/wholesite.pdf
76
- - site/build/site/en/neuralNetworks.pdf
77
- - site/build/site/en/neuralNetworks.html
78
- - site/build/site/en/machineLearning.html
79
- - site/build/site/en/index.html
80
- - site/build/site/en/machineLearning.pdf
81
- - site/build/site/en/locationmap.xml
82
- - site/build/site/en/downloads.html
83
- - site/build/site/en/svn.html
84
- - site/build/site/en/images
85
- - site/build/site/en/linkmap.html
86
- - site/build/site/en/index.pdf
87
- - site/build/site/en/downloads.pdf
88
- - site/build/site/en/broken-links.xml
89
- - site/build/site/en/geneticAlgorithms.pdf
90
- - site/build/site/en/skin
91
- - site/build/site/en/images/s_wn.png
92
- - site/build/site/en/images/c.png
93
- - site/build/site/en/images/t_wbn.png
94
- - site/build/site/en/images/s_wbn.png
95
- - site/build/site/en/images/my_email.png
96
- - site/build/site/en/images/fitness.png
97
- - site/build/site/en/images/built-with-forrest-button.png
98
- - site/build/site/en/images/instruction_arrow.png
99
- - site/build/site/en/images/rubyforge.png
100
- - site/build/site/en/images/ero.gif
101
- - site/build/site/en/images/s.png
102
- - site/build/site/en/images/c_wbn.png
103
- - site/build/site/en/images/c_wn.png
104
- - site/build/site/en/images/europe3.png
105
- - site/build/site/en/images/ai4r-logo.png
106
- - site/build/site/en/images/sigmoid.png
107
- - site/build/site/en/images/t_wn.png
108
- - site/build/site/en/images/t.png
109
- - site/build/site/en/images/europe2.png
110
- - site/build/site/en/skin/print.css
111
- - site/build/site/en/skin/menu.js
112
- - site/build/site/en/skin/breadcrumbs.js
113
- - site/build/site/en/skin/getBlank.js
114
- - site/build/site/en/skin/CommonMessages_es.xml
115
- - site/build/site/en/skin/breadcrumbs-optimized.js
116
- - site/build/site/en/skin/prototype.js
117
- - site/build/site/en/skin/note.txt
118
- - site/build/site/en/skin/scripts
119
- - site/build/site/en/skin/CommonMessages_en_US.xml
120
- - site/build/site/en/skin/CommonMessages_fr.xml
121
- - site/build/site/en/skin/images
122
- - site/build/site/en/skin/CommonMessages_de.xml
123
- - site/build/site/en/skin/css
124
- - site/build/site/en/skin/getMenu.js
125
- - site/build/site/en/skin/fontsize.js
126
- - site/build/site/en/skin/translations
127
- - site/build/site/en/skin/basic.css
128
- - site/build/site/en/skin/profile.css
129
- - site/build/site/en/skin/screen.css
130
- - site/build/site/en/skin/images/label.gif
131
- - site/build/site/en/skin/images/rc-t-r-15-1body-2menu-3menu.png
132
- - site/build/site/en/skin/images/external-link.gif
133
- - site/build/site/en/skin/images/fix.jpg
134
- - site/build/site/en/skin/images/current.gif
135
- - site/build/site/en/skin/images/vcss.png
136
- - site/build/site/en/skin/images/valid-html401.png
137
- - site/build/site/en/skin/images/hack.jpg
138
- - site/build/site/en/skin/images/page.gif
139
- - site/build/site/en/skin/images/rc-t-r-5-1header-2tab-selected-3tab-selected.png
140
- - site/build/site/en/skin/images/rc-b-r-5-1header-2tab-selected-3tab-selected.png
141
- - site/build/site/en/skin/images/success.png
142
- - site/build/site/en/skin/images/chapter.gif
143
- - site/build/site/en/skin/images/built-with-forrest-button.png
144
- - site/build/site/en/skin/images/instruction_arrow.png
145
- - site/build/site/en/skin/images/add.jpg
146
- - site/build/site/en/skin/images/printer.gif
147
- - site/build/site/en/skin/images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png
148
- - site/build/site/en/skin/images/chapter_open.gif
149
- - site/build/site/en/skin/images/pdfdoc.gif
150
- - site/build/site/en/skin/images/spacer.gif
151
- - site/build/site/en/skin/images/rc-b-r-15-1body-2menu-3menu.png
152
- - site/build/site/en/skin/images/rc-t-l-5-1header-2searchbox-3searchbox.png
153
- - site/build/site/en/skin/images/error.png
154
- - site/build/site/en/skin/images/warning.png
155
- - site/build/site/en/skin/images/rc-b-l-15-1body-2menu-3menu.png
156
- - site/build/site/en/skin/images/README.txt
157
- - site/build/site/en/skin/images/rc-t-l-5-1header-2tab-selected-3tab-selected.png
158
- - site/build/site/en/skin/images/forrest-credit-logo.png
159
- - site/build/site/en/skin/images/rc-t-r-5-1header-2searchbox-3searchbox.png
160
- - site/build/site/en/skin/images/info.png
161
- - site/build/site/en/skin/images/poddoc.png
162
- - site/build/site/en/skin/images/remove.jpg
163
- - site/build/site/en/skin/images/update.jpg
164
- - site/build/site/en/skin/images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png
165
- - site/build/site/en/skin/images/txtdoc.png
166
- - site/build/site/en/skin/images/xmldoc.gif
167
- - site/build/site/en/skin/images/header_white_line.gif
168
- - site/build/site/en/skin/images/rss.png
169
- - site/build/tmp/cocoon-work
170
- - site/build/tmp/internal.xmap
171
- - site/build/tmp/brokenlinks.xml
172
- - site/build/tmp/output.xmap
173
- - site/build/tmp/plugins-2.xml
174
- - site/build/tmp/locationmap.xml
175
- - site/build/tmp/input.xmap
176
- - site/build/tmp/pluginlist2fetchbuild.xml
177
- - site/build/tmp/resources.xmap
178
- - site/build/tmp/projfilters.properties
179
- - site/build/tmp/build-info.xml
180
- - site/build/tmp/plugins-1.xml
181
- - site/build/tmp/cocoon-work/cache-dir
182
- - site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.index
183
- - site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.data
74
+ - site/build/webapp/WEB-INF/logs/error.log
75
+ - site/build/webapp/WEB-INF/logs/flow.log
76
+ - site/build/webapp/WEB-INF/logs/idgen.log
77
+ - site/build/webapp/WEB-INF/logs/linkrewriter.log
78
+ - site/build/webapp/WEB-INF/logs/locationmap.log
79
+ - site/build/webapp/WEB-INF/logs/sitemap.log
80
+ - site/build/webapp/WEB-INF/logs/xmlform.log
81
+ - site/forrest.properties
82
+ - site/forrest.properties.dispatcher.properties
83
+ - site/forrest.properties.xml
84
+ - site/src
184
85
  - site/src/documentation
86
+ - site/src/documentation/classes
87
+ - site/src/documentation/classes/CatalogManager.properties
185
88
  - site/src/documentation/conf
186
- - site/src/documentation/sitemap.xmap
187
- - site/src/documentation/resources
188
- - site/src/documentation/skinconf.xml
189
- - site/src/documentation/README.txt
190
89
  - site/src/documentation/content
191
- - site/src/documentation/translations
192
- - site/src/documentation/classes
193
- - site/src/documentation/resources/stylesheets
194
- - site/src/documentation/resources/themes
195
- - site/src/documentation/resources/schema
90
+ - site/src/documentation/content/locationmap.xml
91
+ - site/src/documentation/content/xdocs
92
+ - site/src/documentation/content/xdocs/downloads.html
93
+ - site/src/documentation/content/xdocs/forum.html
94
+ - site/src/documentation/content/xdocs/geneticAlgorithms.xml
95
+ - site/src/documentation/content/xdocs/index.xml
96
+ - site/src/documentation/content/xdocs/machineLearning.xml
97
+ - site/src/documentation/content/xdocs/neuralNetworks.xml
98
+ - site/src/documentation/content/xdocs/site.xml
99
+ - site/src/documentation/content/xdocs/svn.xml
100
+ - site/src/documentation/content/xdocs/tabs.xml
101
+ - site/src/documentation/README.txt
102
+ - site/src/documentation/resources
196
103
  - site/src/documentation/resources/images
197
- - site/src/documentation/resources/stylesheets/hello2document.xsl
198
- - site/src/documentation/resources/schema/symbols-project-v10.ent
199
- - site/src/documentation/resources/schema/catalog.xcat
200
- - site/src/documentation/resources/schema/hello-v10.dtd
201
- - site/src/documentation/resources/images/s_wn.png
202
- - site/src/documentation/resources/images/sub-dir
104
+ - site/src/documentation/resources/images/ai4r-logo.png
203
105
  - site/src/documentation/resources/images/c.png
204
- - site/src/documentation/resources/images/t_wbn.png
205
- - site/src/documentation/resources/images/s_wbn.png
206
- - site/src/documentation/resources/images/project-logo.png
207
- - site/src/documentation/resources/images/my_email.png
208
- - site/src/documentation/resources/images/fitness.png
209
- - site/src/documentation/resources/images/rubyforge.png
210
- - site/src/documentation/resources/images/ero.gif
211
- - site/src/documentation/resources/images/ellipse-2.svg
212
- - site/src/documentation/resources/images/s.png
213
- - site/src/documentation/resources/images/icon.png
214
- - site/src/documentation/resources/images/icon-b.png
215
106
  - site/src/documentation/resources/images/c_wbn.png
216
107
  - site/src/documentation/resources/images/c_wn.png
108
+ - site/src/documentation/resources/images/ellipse-2.svg
109
+ - site/src/documentation/resources/images/ero.gif
110
+ - site/src/documentation/resources/images/europe2.png
217
111
  - site/src/documentation/resources/images/europe3.png
218
- - site/src/documentation/resources/images/ai4r-logo.png
219
- - site/src/documentation/resources/images/sigmoid.png
220
- - site/src/documentation/resources/images/t_wn.png
221
- - site/src/documentation/resources/images/t.png
112
+ - site/src/documentation/resources/images/fitness.png
113
+ - site/src/documentation/resources/images/genetic_algorithms_example.png
222
114
  - site/src/documentation/resources/images/icon-a.png
223
- - site/src/documentation/resources/images/europe2.png
115
+ - site/src/documentation/resources/images/icon-b.png
116
+ - site/src/documentation/resources/images/icon.png
117
+ - site/src/documentation/resources/images/jadeferret.png
118
+ - site/src/documentation/resources/images/my_email.png
119
+ - site/src/documentation/resources/images/neural_network_example.png
120
+ - site/src/documentation/resources/images/project-logo.png
121
+ - site/src/documentation/resources/images/rubyforge.png
122
+ - site/src/documentation/resources/images/s.png
123
+ - site/src/documentation/resources/images/sigmoid.png
124
+ - site/src/documentation/resources/images/sub-dir
224
125
  - site/src/documentation/resources/images/sub-dir/icon-c.png
225
- - site/src/documentation/content/xdocs
226
- - site/src/documentation/content/locationmap.xml
227
- - site/src/documentation/content/xdocs/index.xml
228
- - site/src/documentation/content/xdocs/machineLearning.xml
229
- - site/src/documentation/content/xdocs/downloads.html
230
- - site/src/documentation/content/xdocs/site.xml
231
- - site/src/documentation/content/xdocs/geneticAlgorithms.xml
232
- - site/src/documentation/content/xdocs/neuralNetworks.xml
233
- - site/src/documentation/content/xdocs/svn.xml
234
- - site/src/documentation/content/xdocs/tabs.xml
235
- - site/src/documentation/translations/menu_es.xml
236
- - site/src/documentation/translations/menu_af.xml
126
+ - site/src/documentation/resources/images/sub-dir/Thumbs.db
127
+ - site/src/documentation/resources/images/s_wbn.png
128
+ - site/src/documentation/resources/images/s_wn.png
129
+ - site/src/documentation/resources/images/t.png
130
+ - site/src/documentation/resources/images/Thumbs.db
131
+ - site/src/documentation/resources/images/t_wbn.png
132
+ - site/src/documentation/resources/images/t_wn.png
133
+ - site/src/documentation/resources/schema
134
+ - site/src/documentation/resources/schema/catalog.xcat
135
+ - site/src/documentation/resources/schema/hello-v10.dtd
136
+ - site/src/documentation/resources/schema/symbols-project-v10.ent
137
+ - site/src/documentation/resources/stylesheets
138
+ - site/src/documentation/resources/stylesheets/hello2document.xsl
139
+ - site/src/documentation/resources/themes
140
+ - site/src/documentation/sitemap.xmap
141
+ - site/src/documentation/skinconf.xml
142
+ - site/src/documentation/translations
237
143
  - site/src/documentation/translations/langcode.xml
144
+ - site/src/documentation/translations/languages_de.xml
238
145
  - site/src/documentation/translations/languages_en.xml
239
146
  - site/src/documentation/translations/languages_es.xml
240
- - site/src/documentation/translations/menu_de.xml
241
- - site/src/documentation/translations/menu_nl.xml
242
- - site/src/documentation/translations/tabs_fr.xml
243
- - site/src/documentation/translations/menu_sk.xml
244
- - site/src/documentation/translations/menu_it.xml
245
- - site/src/documentation/translations/menu_ru.xml
246
- - site/src/documentation/translations/languages_de.xml
247
- - site/src/documentation/translations/tabs_de.xml
248
147
  - site/src/documentation/translations/languages_fr.xml
148
+ - site/src/documentation/translations/languages_nl.xml
249
149
  - site/src/documentation/translations/menu.xml
150
+ - site/src/documentation/translations/menu_af.xml
151
+ - site/src/documentation/translations/menu_de.xml
152
+ - site/src/documentation/translations/menu_es.xml
250
153
  - site/src/documentation/translations/menu_fr.xml
251
- - site/src/documentation/translations/tabs_nl.xml
252
- - site/src/documentation/translations/languages_nl.xml
154
+ - site/src/documentation/translations/menu_it.xml
155
+ - site/src/documentation/translations/menu_nl.xml
156
+ - site/src/documentation/translations/menu_no.xml
157
+ - site/src/documentation/translations/menu_ru.xml
158
+ - site/src/documentation/translations/menu_sk.xml
253
159
  - site/src/documentation/translations/tabs.xml
160
+ - site/src/documentation/translations/tabs_de.xml
254
161
  - site/src/documentation/translations/tabs_es.xml
255
- - site/src/documentation/translations/menu_no.xml
256
- - site/src/documentation/classes/CatalogManager.properties
162
+ - site/src/documentation/translations/tabs_fr.xml
163
+ - site/src/documentation/translations/tabs_nl.xml
257
164
  - README.rdoc
258
165
  test_files:
259
- - test/neural_network/backpropagation_test.rb
260
- - test/decision_tree/id3_test.rb
261
- - test/genetic_algorithm/genetic_algorithm_test.rb
166
+ - test/classifiers/id3_test.rb
167
+ - test/classifiers/one_r_test.rb
168
+ - test/classifiers/prism_test.rb
169
+ - test/classifiers/zero_r_test.rb
262
170
  - test/genetic_algorithm/chromosome_test.rb
171
+ - test/genetic_algorithm/genetic_algorithm_test.rb
172
+ - test/neural_network/backpropagation_test.rb
263
173
  rdoc_options: []
264
174
 
265
175
  extra_rdoc_files: