ai4r 1.5 → 1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. data/examples/clusterers/simple_website_clustering.rb +47 -0
  2. data/lib/ai4r.rb +7 -0
  3. data/lib/ai4r/classifiers/hyperpipes.rb +118 -0
  4. data/lib/ai4r/clusterers/average_linkage.rb +22 -23
  5. data/lib/ai4r/clusterers/centroid_linkage.rb +66 -0
  6. data/lib/ai4r/clusterers/complete_linkage.rb +17 -12
  7. data/lib/ai4r/clusterers/diana.rb +139 -0
  8. data/lib/ai4r/clusterers/median_linkage.rb +61 -0
  9. data/lib/ai4r/clusterers/single_linkage.rb +57 -42
  10. data/lib/ai4r/clusterers/ward_linkage.rb +64 -0
  11. data/lib/ai4r/clusterers/weighted_average_linkage.rb +61 -0
  12. data/lib/ai4r/data/constants.rb +18 -0
  13. data/lib/ai4r/data/data_set.rb +5 -3
  14. data/lib/ai4r/data/proximity.rb +18 -0
  15. data/test/clusterers/average_linkage_test.rb +14 -11
  16. data/test/clusterers/bisecting_k_means_test.rb +9 -0
  17. data/test/clusterers/centroid_linkage_test.rb +50 -0
  18. data/test/clusterers/complete_linkage_test.rb +14 -5
  19. data/test/clusterers/diana_test.rb +69 -0
  20. data/test/clusterers/k_means_test.rb +9 -0
  21. data/test/clusterers/median_linkage_test.rb +50 -0
  22. data/test/clusterers/single_linkage_test.rb +15 -6
  23. data/test/clusterers/ward_linkage_test.rb +50 -0
  24. data/test/clusterers/weighted_average_linkage_test.rb +50 -0
  25. data/test/data/data_set_test.rb +14 -0
  26. data/test/data/proximity_test.rb +10 -0
  27. metadata +87 -298
  28. data/site/build/site/en/broken-links.xml +0 -2
  29. data/site/build/site/en/build/tmp/build-info.xml +0 -5
  30. data/site/build/site/en/build/tmp/plugins-1.xml +0 -212
  31. data/site/build/site/en/build/tmp/plugins-2.xml +0 -252
  32. data/site/build/site/en/build/tmp/projfilters.properties +0 -41
  33. data/site/build/site/en/downloads.html +0 -200
  34. data/site/build/site/en/downloads.pdf +0 -151
  35. data/site/build/site/en/geneticAlgorithms.html +0 -591
  36. data/site/build/site/en/geneticAlgorithms.pdf +0 -934
  37. data/site/build/site/en/images/ai4r-logo.png +0 -0
  38. data/site/build/site/en/images/built-with-forrest-button.png +0 -0
  39. data/site/build/site/en/images/c.png +0 -0
  40. data/site/build/site/en/images/c_wbn.png +0 -0
  41. data/site/build/site/en/images/c_wn.png +0 -0
  42. data/site/build/site/en/images/ero.gif +0 -0
  43. data/site/build/site/en/images/europe2.png +0 -0
  44. data/site/build/site/en/images/europe3.png +0 -0
  45. data/site/build/site/en/images/fitness.png +0 -0
  46. data/site/build/site/en/images/genetic_algorithms_example.png +0 -0
  47. data/site/build/site/en/images/instruction_arrow.png +0 -0
  48. data/site/build/site/en/images/jadeferret.png +0 -0
  49. data/site/build/site/en/images/my_email.png +0 -0
  50. data/site/build/site/en/images/neural_network_example.png +0 -0
  51. data/site/build/site/en/images/rubyforge.png +0 -0
  52. data/site/build/site/en/images/s.png +0 -0
  53. data/site/build/site/en/images/s_wbn.png +0 -0
  54. data/site/build/site/en/images/s_wn.png +0 -0
  55. data/site/build/site/en/images/sigmoid.png +0 -0
  56. data/site/build/site/en/images/t.png +0 -0
  57. data/site/build/site/en/images/t_wbn.png +0 -0
  58. data/site/build/site/en/images/t_wn.png +0 -0
  59. data/site/build/site/en/index.html +0 -390
  60. data/site/build/site/en/index.pdf +0 -657
  61. data/site/build/site/en/linkmap.html +0 -261
  62. data/site/build/site/en/linkmap.pdf +0 -94
  63. data/site/build/site/en/locationmap.xml +0 -72
  64. data/site/build/site/en/machineLearning.html +0 -340
  65. data/site/build/site/en/machineLearning.pdf +0 -337
  66. data/site/build/site/en/neuralNetworks.html +0 -521
  67. data/site/build/site/en/neuralNetworks.pdf +0 -671
  68. data/site/build/site/en/skin/CommonMessages_de.xml +0 -23
  69. data/site/build/site/en/skin/CommonMessages_en_US.xml +0 -23
  70. data/site/build/site/en/skin/CommonMessages_es.xml +0 -23
  71. data/site/build/site/en/skin/CommonMessages_fr.xml +0 -23
  72. data/site/build/site/en/skin/basic.css +0 -166
  73. data/site/build/site/en/skin/breadcrumbs-optimized.js +0 -90
  74. data/site/build/site/en/skin/breadcrumbs.js +0 -237
  75. data/site/build/site/en/skin/fontsize.js +0 -166
  76. data/site/build/site/en/skin/getBlank.js +0 -40
  77. data/site/build/site/en/skin/getMenu.js +0 -45
  78. data/site/build/site/en/skin/images/README.txt +0 -1
  79. data/site/build/site/en/skin/images/add.jpg +0 -0
  80. data/site/build/site/en/skin/images/built-with-forrest-button.png +0 -0
  81. data/site/build/site/en/skin/images/chapter.gif +0 -0
  82. data/site/build/site/en/skin/images/chapter_open.gif +0 -0
  83. data/site/build/site/en/skin/images/current.gif +0 -0
  84. data/site/build/site/en/skin/images/error.png +0 -0
  85. data/site/build/site/en/skin/images/external-link.gif +0 -0
  86. data/site/build/site/en/skin/images/fix.jpg +0 -0
  87. data/site/build/site/en/skin/images/forrest-credit-logo.png +0 -0
  88. data/site/build/site/en/skin/images/hack.jpg +0 -0
  89. data/site/build/site/en/skin/images/header_white_line.gif +0 -0
  90. data/site/build/site/en/skin/images/info.png +0 -0
  91. data/site/build/site/en/skin/images/instruction_arrow.png +0 -0
  92. data/site/build/site/en/skin/images/label.gif +0 -0
  93. data/site/build/site/en/skin/images/page.gif +0 -0
  94. data/site/build/site/en/skin/images/pdfdoc.gif +0 -0
  95. data/site/build/site/en/skin/images/poddoc.png +0 -0
  96. data/site/build/site/en/skin/images/printer.gif +0 -0
  97. data/site/build/site/en/skin/images/rc-b-l-15-1body-2menu-3menu.png +0 -0
  98. data/site/build/site/en/skin/images/rc-b-r-15-1body-2menu-3menu.png +0 -0
  99. data/site/build/site/en/skin/images/rc-b-r-5-1header-2tab-selected-3tab-selected.png +0 -0
  100. data/site/build/site/en/skin/images/rc-t-l-5-1header-2searchbox-3searchbox.png +0 -0
  101. data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-selected-3tab-selected.png +0 -0
  102. data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png +0 -0
  103. data/site/build/site/en/skin/images/rc-t-r-15-1body-2menu-3menu.png +0 -0
  104. data/site/build/site/en/skin/images/rc-t-r-5-1header-2searchbox-3searchbox.png +0 -0
  105. data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-selected-3tab-selected.png +0 -0
  106. data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png +0 -0
  107. data/site/build/site/en/skin/images/remove.jpg +0 -0
  108. data/site/build/site/en/skin/images/rss.png +0 -0
  109. data/site/build/site/en/skin/images/spacer.gif +0 -0
  110. data/site/build/site/en/skin/images/success.png +0 -0
  111. data/site/build/site/en/skin/images/txtdoc.png +0 -0
  112. data/site/build/site/en/skin/images/update.jpg +0 -0
  113. data/site/build/site/en/skin/images/valid-html401.png +0 -0
  114. data/site/build/site/en/skin/images/vcss.png +0 -0
  115. data/site/build/site/en/skin/images/warning.png +0 -0
  116. data/site/build/site/en/skin/images/xmldoc.gif +0 -0
  117. data/site/build/site/en/skin/menu.js +0 -48
  118. data/site/build/site/en/skin/note.txt +0 -50
  119. data/site/build/site/en/skin/print.css +0 -54
  120. data/site/build/site/en/skin/profile.css +0 -163
  121. data/site/build/site/en/skin/prototype.js +0 -1257
  122. data/site/build/site/en/skin/screen.css +0 -587
  123. data/site/build/site/en/sourceCode.html +0 -244
  124. data/site/build/site/en/sourceCode.pdf +0 -278
  125. data/site/build/site/en/svn.html +0 -244
  126. data/site/build/site/en/svn.pdf +0 -278
  127. data/site/build/tmp/brokenlinks.xml +0 -2
  128. data/site/build/tmp/build-info.xml +0 -5
  129. data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.data +0 -0
  130. data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.index +0 -0
  131. data/site/build/tmp/input.xmap +0 -32
  132. data/site/build/tmp/internal.xmap +0 -32
  133. data/site/build/tmp/locationmap.xml +0 -29
  134. data/site/build/tmp/output.xmap +0 -38
  135. data/site/build/tmp/pluginlist2fetchbuild.xml +0 -144
  136. data/site/build/tmp/plugins-1.xml +0 -201
  137. data/site/build/tmp/plugins-2.xml +0 -401
  138. data/site/build/tmp/projfilters.properties +0 -41
  139. data/site/build/tmp/resources.xmap +0 -32
  140. data/site/build/webapp/WEB-INF/logs/access.log +0 -0
  141. data/site/build/webapp/WEB-INF/logs/core.log +0 -775
  142. data/site/build/webapp/WEB-INF/logs/debug.log +0 -0
  143. data/site/build/webapp/WEB-INF/logs/error.log +0 -213
  144. data/site/build/webapp/WEB-INF/logs/flow.log +0 -0
  145. data/site/build/webapp/WEB-INF/logs/idgen.log +0 -0
  146. data/site/build/webapp/WEB-INF/logs/linkrewriter.log +0 -0
  147. data/site/build/webapp/WEB-INF/logs/locationmap.log +0 -0
  148. data/site/build/webapp/WEB-INF/logs/sitemap.log +0 -0
  149. data/site/build/webapp/WEB-INF/logs/xmlform.log +0 -0
  150. data/site/forrest.properties +0 -152
  151. data/site/forrest.properties.dispatcher.properties +0 -25
  152. data/site/forrest.properties.xml +0 -29
  153. data/site/src/documentation/README.txt +0 -7
  154. data/site/src/documentation/classes/CatalogManager.properties +0 -62
  155. data/site/src/documentation/content/locationmap.xml +0 -72
  156. data/site/src/documentation/content/xdocs/downloads.html +0 -9
  157. data/site/src/documentation/content/xdocs/geneticAlgorithms.xml +0 -294
  158. data/site/src/documentation/content/xdocs/index.xml +0 -129
  159. data/site/src/documentation/content/xdocs/machineLearning.xml +0 -131
  160. data/site/src/documentation/content/xdocs/neuralNetworks.xml +0 -270
  161. data/site/src/documentation/content/xdocs/site.xml +0 -54
  162. data/site/src/documentation/content/xdocs/sourceCode.xml +0 -43
  163. data/site/src/documentation/content/xdocs/tabs.xml +0 -35
  164. data/site/src/documentation/resources/images/ai4r-logo.png +0 -0
  165. data/site/src/documentation/resources/images/c.png +0 -0
  166. data/site/src/documentation/resources/images/c_wbn.png +0 -0
  167. data/site/src/documentation/resources/images/c_wn.png +0 -0
  168. data/site/src/documentation/resources/images/ellipse-2.svg +0 -30
  169. data/site/src/documentation/resources/images/ero.gif +0 -0
  170. data/site/src/documentation/resources/images/europe2.png +0 -0
  171. data/site/src/documentation/resources/images/europe3.png +0 -0
  172. data/site/src/documentation/resources/images/fitness.png +0 -0
  173. data/site/src/documentation/resources/images/genetic_algorithms_example.png +0 -0
  174. data/site/src/documentation/resources/images/icon-a.png +0 -0
  175. data/site/src/documentation/resources/images/icon-b.png +0 -0
  176. data/site/src/documentation/resources/images/icon.png +0 -0
  177. data/site/src/documentation/resources/images/jadeferret.png +0 -0
  178. data/site/src/documentation/resources/images/my_email.png +0 -0
  179. data/site/src/documentation/resources/images/neural_network_example.png +0 -0
  180. data/site/src/documentation/resources/images/project-logo.png +0 -0
  181. data/site/src/documentation/resources/images/rubyforge.png +0 -0
  182. data/site/src/documentation/resources/images/s.png +0 -0
  183. data/site/src/documentation/resources/images/s_wbn.png +0 -0
  184. data/site/src/documentation/resources/images/s_wn.png +0 -0
  185. data/site/src/documentation/resources/images/sigmoid.png +0 -0
  186. data/site/src/documentation/resources/images/sub-dir/icon-c.png +0 -0
  187. data/site/src/documentation/resources/images/t.png +0 -0
  188. data/site/src/documentation/resources/images/t_wbn.png +0 -0
  189. data/site/src/documentation/resources/images/t_wn.png +0 -0
  190. data/site/src/documentation/resources/schema/catalog.xcat +0 -29
  191. data/site/src/documentation/resources/schema/hello-v10.dtd +0 -51
  192. data/site/src/documentation/resources/schema/symbols-project-v10.ent +0 -26
  193. data/site/src/documentation/resources/stylesheets/hello2document.xsl +0 -33
  194. data/site/src/documentation/sitemap.xmap +0 -66
  195. data/site/src/documentation/skinconf.xml +0 -418
  196. data/site/src/documentation/translations/langcode.xml +0 -29
  197. data/site/src/documentation/translations/languages_de.xml +0 -24
  198. data/site/src/documentation/translations/languages_en.xml +0 -24
  199. data/site/src/documentation/translations/languages_es.xml +0 -22
  200. data/site/src/documentation/translations/languages_fr.xml +0 -24
  201. data/site/src/documentation/translations/languages_nl.xml +0 -24
  202. data/site/src/documentation/translations/menu.xml +0 -33
  203. data/site/src/documentation/translations/menu_af.xml +0 -33
  204. data/site/src/documentation/translations/menu_de.xml +0 -33
  205. data/site/src/documentation/translations/menu_es.xml +0 -33
  206. data/site/src/documentation/translations/menu_fr.xml +0 -33
  207. data/site/src/documentation/translations/menu_it.xml +0 -33
  208. data/site/src/documentation/translations/menu_nl.xml +0 -33
  209. data/site/src/documentation/translations/menu_no.xml +0 -33
  210. data/site/src/documentation/translations/menu_ru.xml +0 -33
  211. data/site/src/documentation/translations/menu_sk.xml +0 -33
  212. data/site/src/documentation/translations/tabs.xml +0 -22
  213. data/site/src/documentation/translations/tabs_de.xml +0 -22
  214. data/site/src/documentation/translations/tabs_es.xml +0 -22
  215. data/site/src/documentation/translations/tabs_fr.xml +0 -22
  216. data/site/src/documentation/translations/tabs_nl.xml +0 -22
@@ -1,261 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
- <html>
3
- <head>
4
- <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <meta content="Apache Forrest" name="Generator">
6
- <meta name="Forrest-version" content="0.8">
7
- <meta name="Forrest-skin-name" content="pelt">
8
- <title>Site Linkmap Table of Contents</title>
9
- <link type="text/css" href="skin/basic.css" rel="stylesheet">
10
- <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
11
- <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
12
- <link type="text/css" href="skin/profile.css" rel="stylesheet">
13
- <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
14
- <link rel="shortcut icon" href="">
15
- </head>
16
- <body onload="init()">
17
- <script type="text/javascript">ndeSetTextSize();</script>
18
- <div id="top">
19
- <!--+
20
- |header
21
- +-->
22
- <div class="header">
23
- <!--+
24
- |start group logo
25
- +-->
26
- <div class="grouplogo">
27
- <a href="http://www.jadeferret.com"><img class="logoImage" alt="Jade Ferret" src="images/jadeferret.png" title="Jade Ferret"></a>
28
- </div>
29
- <!--+
30
- |end group logo
31
- +-->
32
- <!--+
33
- |start Project Logo
34
- +-->
35
- <div class="projectlogo">
36
- <a href="http://ai4r.rubyforge.org/"><img class="logoImage" alt="ai4r" src="images/ai4r-logo.png" title="AI4R - Artificial Intelligence for Ruby"></a>
37
- </div>
38
- <!--+
39
- |end Project Logo
40
- +-->
41
- <!--+
42
- |start Search
43
- +-->
44
- <div class="searchbox">
45
- <div class="roundtopsmall">
46
- <form target="_top" action="http://www.google.com/custom" method="get">
47
- <input value="ai4r.rubyforge.org;raa.ruby-lang.org;rubyforge.org" name="domains" type="hidden"><label style="display: none" for="sbi">Enter your search terms</label><input id="sbi" value="" maxlength="255" size="31" name="q" type="text"><label style="display: none" for="sbb">Submit search form</label><input id="sbb" value="Search" name="sa" type="submit"><span style="display:none"><input id="ss0" value="" name="sitesearch" style="display=none" type="radio"><input id="ss1" checked value="ai4r.rubyforge.org" name="sitesearch" style="display=none" type="radio"><input id="ss2" value="raa.ruby-lang.org" name="sitesearch" style="display=none" type="radio"><input id="ss3" value="rubyforge.org" name="sitesearch" style="display=none" type="radio"></span><input value="pub-2578934938711895" name="client" type="hidden"><input value="1" name="forid" type="hidden"><input value="ISO-8859-1" name="ie" type="hidden"><input value="ISO-8859-1" name="oe" type="hidden"><input value="active" name="safe" type="hidden"><input value="0000" name="flav" type="hidden"><input value="XEZZoGuMPMQqvUG_" name="sig" type="hidden"><input value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:78;L:http://ai4r.rubyforge.org/images/ai4r-logo.png;S:http://ai4r.rubyforge.org/;FORID:1" name="cof" type="hidden"><input value="en" name="hl" type="hidden">
48
- </form>
49
- </div>
50
- </div>
51
- <!--+
52
- |end search
53
- +-->
54
- <!--+
55
- |start Tabs
56
- +-->
57
- <ul id="tabs">
58
- <li class="current">
59
- <a class="selected" href="index.html">Home</a>
60
- </li>
61
- </ul>
62
- <!--+
63
- |end Tabs
64
- +-->
65
- </div>
66
- </div>
67
- <div id="main">
68
- <div id="publishedStrip">
69
- <!--+
70
- |start Subtabs
71
- +-->
72
- <div id="level2tabs"></div>
73
- <!--+
74
- |end Endtabs
75
- +-->
76
- <script type="text/javascript"><!--
77
- document.write("Last Published: " + document.lastModified);
78
- // --></script>
79
- </div>
80
- <!--+
81
- |breadtrail
82
- +-->
83
- <div class="breadtrail">
84
-
85
- &nbsp;
86
- </div>
87
- <!--+
88
- |start Menu, mainarea
89
- +-->
90
- <!--+
91
- |start Menu
92
- +-->
93
- <div id="menu">
94
- <div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Home</div>
95
- <div id="menu_1.1" class="menuitemgroup">
96
- <div class="menuitem">
97
- <a href="index.html" title="ai4r - Artificial Intelligence for Ruby">Index</a>
98
- </div>
99
- <div onclick="SwitchMenu('menu_1.1.2', 'skin/')" id="menu_1.1.2Title" class="menutitle">Practical Examples</div>
100
- <div id="menu_1.1.2" class="menuitemgroup">
101
- <div class="menuitem">
102
- <a href="geneticAlgorithms.html" title="Genetic Algorithms in ruby">Genetic Algorithms</a>
103
- </div>
104
- <div class="menuitem">
105
- <a href="machineLearning.html" title="ID3 Decision Trees in ruby">Machine Learning</a>
106
- </div>
107
- <div class="menuitem">
108
- <a href="neuralNetworks.html" title="Backpropagation Neural Network in ruby">Neural Networks</a>
109
- </div>
110
- </div>
111
- <div class="menuitem">
112
- <a href="downloads.html" title="ai4r - Download Files">Downloads</a>
113
- </div>
114
- <div class="menuitem">
115
- <a href="http://forum.jadeferret.com/viewforum.php?f=3" title="Ai4r Forum">Forum</a>
116
- </div>
117
- <div class="menuitem">
118
- <a href="sourceCode.html" title="ai4r source code repository">Source Code repository</a>
119
- </div>
120
- <div class="menuitem">
121
- <a href="http://wiki.jadeferret.com/Category:AI4R" title="ai4r wiki with How-to guides and more documentation">AI4R Wiki</a>
122
- </div>
123
- <div class="menuitem">
124
- <a href="http://ai4r.rubyforge.org/rdoc/index.html" title="Ai4 RDoc docs">API doc (Rdoc)</a>
125
- </div>
126
- </div>
127
- <div id="credit">
128
- <script type="text/javascript">
129
- google_ad_client = "pub-2578934938711895";
130
- google_ad_slot = "6111091580";
131
- google_ad_width = 125;
132
- google_ad_height = 125;
133
- </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
134
- <hr>
135
- </div>
136
- <div id="roundbottom">
137
- <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
138
- <!--+
139
- |alternative credits
140
- +-->
141
- <div id="credit2"></div>
142
- </div>
143
- <!--+
144
- |end Menu
145
- +-->
146
- <!--+
147
- |start content
148
- +-->
149
- <div id="content">
150
- <div title="Portable Document Format" class="pdflink">
151
- <a class="dida" href="linkmap.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
152
- PDF</a>
153
- </div>
154
- <h1>Site Linkmap Table of Contents</h1>
155
- <p>
156
- This is a map of the complete site and its structure.
157
- </p>
158
- <ul>
159
- <li>
160
- <a>ai4r</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>site</em>
161
- </li>
162
- <ul>
163
-
164
- <ul>
165
- <li>
166
- <a>Home</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>about</em>
167
- </li>
168
- <ul>
169
-
170
- <ul>
171
- <li>
172
- <a href="index.html">Index</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>index</em>&nbsp;: ai4r - Artificial Intelligence for Ruby</li>
173
- </ul>
174
-
175
- <ul>
176
- <li>
177
- <a>Practical Examples</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>practicalExamples</em>
178
- </li>
179
- <ul>
180
-
181
- <ul>
182
- <li>
183
- <a href="geneticAlgorithms.html">Genetic Algorithms</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>geneticAlgorithms</em>&nbsp;: Genetic Algorithms in ruby</li>
184
- </ul>
185
-
186
- <ul>
187
- <li>
188
- <a href="machineLearning.html">Machine Learning</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>machineLearning</em>&nbsp;: ID3 Decision Trees in ruby</li>
189
- </ul>
190
-
191
- <ul>
192
- <li>
193
- <a href="neuralNetworks.html">Neural Networks</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>neuralNetworks</em>&nbsp;: Backpropagation Neural Network in ruby</li>
194
- </ul>
195
-
196
- </ul>
197
- </ul>
198
-
199
- <ul>
200
- <li>
201
- <a href="downloads.html">Downloads</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>download</em>&nbsp;: ai4r - Download Files</li>
202
- </ul>
203
-
204
- <ul>
205
- <li>
206
- <a class="external" href="http://forum.jadeferret.com/viewforum.php?f=3">Forum</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>forum</em>&nbsp;: Ai4r Forum</li>
207
- </ul>
208
-
209
- <ul>
210
- <li>
211
- <a href="sourceCode.html">Source Code repository</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>svn</em>&nbsp;: ai4r source code repository</li>
212
- </ul>
213
-
214
- <ul>
215
- <li>
216
- <a class="external" href="http://wiki.jadeferret.com/Category:AI4R">AI4R Wiki</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>wiki</em>&nbsp;: ai4r wiki with How-to guides and more documentation</li>
217
- </ul>
218
-
219
- <ul>
220
- <li>
221
- <a href="http://ai4r.rubyforge.org/rdoc/index.html">API doc (Rdoc)</a>&nbsp;&nbsp;___________________&nbsp;&nbsp;<em>rdoc</em>&nbsp;: Ai4 RDoc docs</li>
222
- </ul>
223
-
224
- </ul>
225
- </ul>
226
-
227
- </ul>
228
- </ul>
229
- </div>
230
- <!--+
231
- |end content
232
- +-->
233
- <div class="clearboth">&nbsp;</div>
234
- </div>
235
- <div id="footer">
236
- <!--+
237
- |start bottomstrip
238
- +-->
239
- <div class="lastmodified">
240
- <script type="text/javascript"><!--
241
- document.write("Last Published: " + document.lastModified);
242
- // --></script>
243
- </div>
244
- <div class="copyright">
245
- Copyright &copy;
246
- 2007-2009 <a href="http://www.jadeferret.com/">Sergio Fierens, Jade Ferret</a>
247
- </div>
248
- <div class="host">
249
- <a href="http://rubyforge.org/projects/ai4r/"><img class="logoImage" alt="" src="images/rubyforge.png"></a>
250
- </div>
251
- <!--+
252
- |end bottomstrip
253
- +-->
254
- </div>
255
- <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script><script type="text/javascript">
256
- var pageTracker = _gat._getTracker("UA-3234625-1");
257
- pageTracker._initData();
258
- pageTracker._trackPageview();
259
- </script>
260
- </body>
261
- </html>
@@ -1,94 +0,0 @@
1
- %PDF-1.3
2
- %����
3
- 4 0 obj
4
- << /Type /Info
5
- /Producer (FOP 0.20.5) >>
6
- endobj
7
- 5 0 obj
8
- << /Length 1200 /Filter [ /ASCII85Decode /FlateDecode ]
9
- >>
10
- stream
11
- Gat=+?#S1G'RfGRaQ"VPi/]i>]QG`Y,!`A4idi8;-#RHLM2UCJp@!!a[^NNRJdcAg3qGMt*oH:!?a"+GQe4ZV&%qRI#.ji?)=WM$oRQcC]qh,*"5r2np=>N'rSii/HKe_/-rs\-5-k$i8p>SjSN`:XGJ;Jb)dZ0@bN@7MiN5<mAE#m3+Bre1MYn"g"5J4GRa)*$^0I&c<"J^3#%N0'`c=_[On!0f;JF?3bd>eZ2isg9eO\)"Z5(kREeb.m,k7(Cci"n.E[Flo3a"uZr88-'ao\8E$0YfI^AL"&$X^D2"SlJ>q\oTY1I,Bh+FlWW(?[1RLWJBEMG>L_,X+]&m6?$WXZT*&lm<!9^E&P>F\_s1jb,?hS,sX[%3D(1Yi:=EBJ4[A,gNW0Hg=97k<cH`b?.s5\WnXrZ=F-@1F)WP>jMb:Ko#VR;E5@3+E-"ikODpPEWpHW.qU'Y(Qi<mAL<,?J'tJ4R`Qa#ENb-$]0"qan*WnF]$([/,?%+6hpIlBDhaKf_$-%WC,5)TLOPC/)n$T&9^ba-"@]?!A)"hhd=rdrPuL!mSatrR3Li%9*fC^/4=GqoB3BUSZRr5;PkmpL;7!j$Y*V3B6#;0S",cg><XUCb_U3CZ>,hTDPC0dR3edg_=MqYBc!!s?hm*:B/<A,a'kV<1VXfS%a6?a(@d-lK1$]lK]69):Yb+=W^&#*L3'fS5YLDiX-ho;G;JF87#k-XSm*?If@:t?tn>EkYBg2JP;%61k/INf\4$=fg!9'<u^Dt@RUZ]P=P3Kl!'K-8fjgO6EXep<9TdD=@c/A+c(K./JK^;,saE&lmV;Z8*'fN(/'\+4BL"Vc0G]$W8m^Ti*E:H'$3agB[%Z<^G]0<^M\8+"D?K0c)Ae[M]#B6EB@K^h-R=Uo,$m92XR]h<I%JPiFZH5\3Y)Zp-fP"'o6[);Dh464-f/U_eS7tW6[Ip+U>tM3dU1O/DZKS,PWpT-LS9\hO\1k;9H.H$]_S8<u:'cbW-Zp0Vr6*6'V2bA1>@l]!:)5mFr>j]\(HmF5$\>lO`:ahUp9\hO0\Iqj#8uF%B>=;p<W?$K+S$bOXpU^#Hpg(_^!5p0m(.P/+na[K^WL"""iPYM6,b%)M3hVB6j&bp^3^WsfLl+t\jlm<$NUfQl]-jSEG[?H'sqjbl'W&rDEQsF<![76SsQ93HJHNEBg]jXReo/4^Y3C0-i~>
12
- endstream
13
- endobj
14
- 6 0 obj
15
- << /Type /Page
16
- /Parent 1 0 R
17
- /MediaBox [ 0 0 612 792 ]
18
- /Resources 3 0 R
19
- /Contents 5 0 R
20
- >>
21
- endobj
22
- 7 0 obj
23
- << /Type /Font
24
- /Subtype /Type1
25
- /Name /F3
26
- /BaseFont /Helvetica-Bold
27
- /Encoding /WinAnsiEncoding >>
28
- endobj
29
- 8 0 obj
30
- << /Type /Font
31
- /Subtype /Type1
32
- /Name /F5
33
- /BaseFont /Times-Roman
34
- /Encoding /WinAnsiEncoding >>
35
- endobj
36
- 9 0 obj
37
- << /Type /Font
38
- /Subtype /Type1
39
- /Name /F6
40
- /BaseFont /Times-Italic
41
- /Encoding /WinAnsiEncoding >>
42
- endobj
43
- 10 0 obj
44
- << /Type /Font
45
- /Subtype /Type1
46
- /Name /F1
47
- /BaseFont /Helvetica
48
- /Encoding /WinAnsiEncoding >>
49
- endobj
50
- 11 0 obj
51
- << /Type /Font
52
- /Subtype /Type1
53
- /Name /F2
54
- /BaseFont /Helvetica-Oblique
55
- /Encoding /WinAnsiEncoding >>
56
- endobj
57
- 1 0 obj
58
- << /Type /Pages
59
- /Count 1
60
- /Kids [6 0 R ] >>
61
- endobj
62
- 2 0 obj
63
- << /Type /Catalog
64
- /Pages 1 0 R
65
- >>
66
- endobj
67
- 3 0 obj
68
- <<
69
- /Font << /F3 7 0 R /F5 8 0 R /F1 10 0 R /F6 9 0 R /F2 11 0 R >>
70
- /ProcSet [ /PDF /ImageC /Text ] >>
71
- endobj
72
- xref
73
- 0 12
74
- 0000000000 65535 f
75
- 0000002024 00000 n
76
- 0000002082 00000 n
77
- 0000002132 00000 n
78
- 0000000015 00000 n
79
- 0000000071 00000 n
80
- 0000001363 00000 n
81
- 0000001469 00000 n
82
- 0000001581 00000 n
83
- 0000001690 00000 n
84
- 0000001800 00000 n
85
- 0000001908 00000 n
86
- trailer
87
- <<
88
- /Size 12
89
- /Root 2 0 R
90
- /Info 4 0 R
91
- >>
92
- startxref
93
- 2252
94
- %%EOF
@@ -1,72 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- Licensed to the Apache Software Foundation (ASF) under one or more
4
- contributor license agreements. See the NOTICE file distributed with
5
- this work for additional information regarding copyright ownership.
6
- The ASF licenses this file to You under the Apache License, Version 2.0
7
- (the "License"); you may not use this file except in compliance with
8
- the License. You may obtain a copy of the License at
9
-
10
- http://www.apache.org/licenses/LICENSE-2.0
11
-
12
- Unless required by applicable law or agreed to in writing, software
13
- distributed under the License is distributed on an "AS IS" BASIS,
14
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- See the License for the specific language governing permissions and
16
- limitations under the License.
17
- -->
18
- <locationmap xmlns="http://apache.org/forrest/locationmap/1.0">
19
- <components>
20
- <matchers default="lm">
21
- <matcher name="lm" src="org.apache.forrest.locationmap.WildcardLocationMapHintMatcher"/>
22
- </matchers>
23
- <!--
24
- * Can contain any sitemap selector with the following syntax. *
25
- <selectors default="exists">
26
- <selector name="exists" logger="sitemap.selector.exists"
27
- src="org.apache.forrest.sourceexists.SourceExistsSelector" />
28
- </selectors>
29
- -->
30
- </components>
31
- <!--
32
- * Can contain a mount statement as a sibling to components and locator *
33
- <mount src="somelocation.xml"/>
34
- -->
35
- <locator>
36
- <!--
37
- * Can contain a mount within a selector where a selector is valid.
38
- <select>
39
- <mount src="somelocation.xml"/>
40
- </select>
41
- -->
42
- <match pattern="project.rewrite.**">
43
- <location src="http://cocoon.apache.org/{1}.html"/>
44
- </match>
45
- <match pattern="project.remote.**.xml">
46
- <location src="http://svn.apache.org/repos/asf/forrest/trunk/main/fresh-site/src/documentation/content/xdocs/{1}.xml"/>
47
- </match>
48
- <!--
49
- * Can use a selector inside a match. *
50
- <match pattern="somepattern/**">
51
- <select>
52
- <location src="first-location-attempted"/>
53
- <location src="second-location-attempted"/>
54
- <location src="third-location-attepted"/>
55
- </select>
56
- </match>
57
- -->
58
- <!--
59
- To locate all your source documents in a slide repository you can do:
60
-
61
- <match pattern="tabs.xml">
62
- <location src="http://127.0.0.1:8080/slide/files/tabs.xml"/>
63
- </match>
64
- <match pattern="site.xml">
65
- <location src="http://127.0.0.1:8080/slide/files/site.xml"/>
66
- </match>
67
- <match pattern="**.xml">
68
- <location src="http://127.0.0.1:8080/slide/files/{1}.xml"/>
69
- </match>
70
- -->
71
- </locator>
72
- </locationmap>
@@ -1,340 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
- <html>
3
- <head>
4
- <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <meta content="Apache Forrest" name="Generator">
6
- <meta name="Forrest-version" content="0.8">
7
- <meta name="Forrest-skin-name" content="pelt">
8
- <title>Machine Learning with ID3 Decision Trees in Ruby</title>
9
- <link type="text/css" href="skin/basic.css" rel="stylesheet">
10
- <link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
11
- <link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
12
- <link type="text/css" href="skin/profile.css" rel="stylesheet">
13
- <script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
14
- <link rel="shortcut icon" href="">
15
- </head>
16
- <body onload="init()">
17
- <script type="text/javascript">ndeSetTextSize();</script>
18
- <div id="top">
19
- <!--+
20
- |header
21
- +-->
22
- <div class="header">
23
- <!--+
24
- |start group logo
25
- +-->
26
- <div class="grouplogo">
27
- <a href="http://www.jadeferret.com"><img class="logoImage" alt="Jade Ferret" src="images/jadeferret.png" title="Jade Ferret"></a>
28
- </div>
29
- <!--+
30
- |end group logo
31
- +-->
32
- <!--+
33
- |start Project Logo
34
- +-->
35
- <div class="projectlogo">
36
- <a href="http://ai4r.rubyforge.org/"><img class="logoImage" alt="ai4r" src="images/ai4r-logo.png" title="AI4R - Artificial Intelligence for Ruby"></a>
37
- </div>
38
- <!--+
39
- |end Project Logo
40
- +-->
41
- <!--+
42
- |start Search
43
- +-->
44
- <div class="searchbox">
45
- <div class="roundtopsmall">
46
- <form target="_top" action="http://www.google.com/custom" method="get">
47
- <input value="ai4r.rubyforge.org;raa.ruby-lang.org;rubyforge.org" name="domains" type="hidden"><label style="display: none" for="sbi">Enter your search terms</label><input id="sbi" value="" maxlength="255" size="31" name="q" type="text"><label style="display: none" for="sbb">Submit search form</label><input id="sbb" value="Search" name="sa" type="submit"><span style="display:none"><input id="ss0" value="" name="sitesearch" style="display=none" type="radio"><input id="ss1" checked value="ai4r.rubyforge.org" name="sitesearch" style="display=none" type="radio"><input id="ss2" value="raa.ruby-lang.org" name="sitesearch" style="display=none" type="radio"><input id="ss3" value="rubyforge.org" name="sitesearch" style="display=none" type="radio"></span><input value="pub-2578934938711895" name="client" type="hidden"><input value="1" name="forid" type="hidden"><input value="ISO-8859-1" name="ie" type="hidden"><input value="ISO-8859-1" name="oe" type="hidden"><input value="active" name="safe" type="hidden"><input value="0000" name="flav" type="hidden"><input value="XEZZoGuMPMQqvUG_" name="sig" type="hidden"><input value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:78;L:http://ai4r.rubyforge.org/images/ai4r-logo.png;S:http://ai4r.rubyforge.org/;FORID:1" name="cof" type="hidden"><input value="en" name="hl" type="hidden">
48
- </form>
49
- </div>
50
- </div>
51
- <!--+
52
- |end search
53
- +-->
54
- <!--+
55
- |start Tabs
56
- +-->
57
- <ul id="tabs">
58
- <li class="current">
59
- <a class="selected" href="index.html">Home</a>
60
- </li>
61
- </ul>
62
- <!--+
63
- |end Tabs
64
- +-->
65
- </div>
66
- </div>
67
- <div id="main">
68
- <div id="publishedStrip">
69
- <!--+
70
- |start Subtabs
71
- +-->
72
- <div id="level2tabs"></div>
73
- <!--+
74
- |end Endtabs
75
- +-->
76
- <script type="text/javascript"><!--
77
- document.write("Last Published: " + document.lastModified);
78
- // --></script>
79
- </div>
80
- <!--+
81
- |breadtrail
82
- +-->
83
- <div class="breadtrail">
84
-
85
- &nbsp;
86
- </div>
87
- <!--+
88
- |start Menu, mainarea
89
- +-->
90
- <!--+
91
- |start Menu
92
- +-->
93
- <div id="menu">
94
- <div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Home</div>
95
- <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
96
- <div class="menuitem">
97
- <a href="index.html" title="ai4r - Artificial Intelligence for Ruby">Index</a>
98
- </div>
99
- <div onclick="SwitchMenu('menu_selected_1.1.2', 'skin/')" id="menu_selected_1.1.2Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Practical Examples</div>
100
- <div id="menu_selected_1.1.2" class="selectedmenuitemgroup" style="display: block;">
101
- <div class="menuitem">
102
- <a href="geneticAlgorithms.html" title="Genetic Algorithms in ruby">Genetic Algorithms</a>
103
- </div>
104
- <div class="menupage">
105
- <div class="menupagetitle">Machine Learning</div>
106
- </div>
107
- <div class="menuitem">
108
- <a href="neuralNetworks.html" title="Backpropagation Neural Network in ruby">Neural Networks</a>
109
- </div>
110
- </div>
111
- <div class="menuitem">
112
- <a href="downloads.html" title="ai4r - Download Files">Downloads</a>
113
- </div>
114
- <div class="menuitem">
115
- <a href="http://forum.jadeferret.com/viewforum.php?f=3" title="Ai4r Forum">Forum</a>
116
- </div>
117
- <div class="menuitem">
118
- <a href="sourceCode.html" title="ai4r source code repository">Source Code repository</a>
119
- </div>
120
- <div class="menuitem">
121
- <a href="http://wiki.jadeferret.com/Category:AI4R" title="ai4r wiki with How-to guides and more documentation">AI4R Wiki</a>
122
- </div>
123
- <div class="menuitem">
124
- <a href="http://ai4r.rubyforge.org/rdoc/index.html" title="Ai4 RDoc docs">API doc (Rdoc)</a>
125
- </div>
126
- </div>
127
- <div id="credit">
128
- <script type="text/javascript">
129
- google_ad_client = "pub-2578934938711895";
130
- google_ad_slot = "6111091580";
131
- google_ad_width = 125;
132
- google_ad_height = 125;
133
- </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
134
- <hr>
135
- </div>
136
- <div id="roundbottom">
137
- <img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
138
- <!--+
139
- |alternative credits
140
- +-->
141
- <div id="credit2"></div>
142
- </div>
143
- <!--+
144
- |end Menu
145
- +-->
146
- <!--+
147
- |start content
148
- +-->
149
- <div id="content">
150
- <div title="Portable Document Format" class="pdflink">
151
- <a class="dida" href="machineLearning.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
152
- PDF</a>
153
- </div>
154
- <h1>Machine Learning with ID3 Decision Trees in Ruby</h1>
155
- <div id="minitoc-area">
156
- <ul class="minitoc">
157
- <li>
158
- <a href="#mach-intro">Introduction to ID3 algorithm</a>
159
- </li>
160
- <li>
161
- <a href="#mach-HowTo">Marketing target strategy example using ID3 Decision Trees in Ruby</a>
162
- </li>
163
- <li>
164
- <a href="#mach-dataload">Better data loading</a>
165
- </li>
166
- <li>
167
- <a href="#mach-eval">A good tip for data evaluation</a>
168
- </li>
169
- <li>
170
- <a href="#mach-more">More about ID3 and decision trees</a>
171
- </li>
172
- </ul>
173
- </div>
174
-
175
- <a name="N1000C"></a><a name="mach-intro"></a>
176
- <h2 class="boxed">Introduction to ID3 algorithm</h2>
177
- <div class="section">
178
- <p>
179
- AI4R implements the ID3 algorithm (Quinlan) as one of its automatic classifiers.
180
- Given a set of preclassified examples, it builds a top-down
181
- induction of decision tree, biased by the information gain and
182
- entropy measure.
183
- </p>
184
- <p>
185
- The good thing about this automatic learning method is that humans learns as well.
186
- Unlike other AI techniques like neural networks, classifiers can
187
- generate ruby code with if / else sentences. You
188
- can use this to evaluate parameters on realtime, copy paste them in a
189
- code, or just read them to learn about your problem domain.
190
- </p>
191
- </div>
192
-
193
-
194
- <a name="N10019"></a><a name="mach-HowTo"></a>
195
- <h2 class="boxed">Marketing target strategy example using ID3 Decision Trees in Ruby</h2>
196
- <div class="section">
197
- <p>Let's suppose that you are writting an application that must identify people as relevant marketing targets or not.
198
- The only information that you have is a collection of examples, provided by a marketing survey:</p>
199
- <pre class="code">
200
-
201
- DATA_LABELS = [ 'city', 'age_range', 'gender', 'marketing_target' ]
202
-
203
- DATA_SET = [
204
- ['New York', '&lt;30', 'M', 'Y'],
205
- ['Chicago', '&lt;30', 'M', 'Y'],
206
- ['Chicago', '&lt;30', 'F', 'Y'],
207
- ['New York', '&lt;30', 'M', 'Y'],
208
- ['New York', '&lt;30', 'M', 'Y'],
209
- ['Chicago', '[30-50)', 'M', 'Y'],
210
- ['New York', '[30-50)', 'F', 'N'],
211
- ['Chicago', '[30-50)', 'F', 'Y'],
212
- ['New York', '[30-50)', 'F', 'N'],
213
- ['Chicago', '[50-80]', 'M', 'N'],
214
- ['New York', '[50-80]', 'F', 'N'],
215
- ['New York', '[50-80]', 'M', 'N'],
216
- ['Chicago', '[50-80]', 'M', 'N'],
217
- ['New York', '[50-80]', 'F', 'N'],
218
- ['Chicago', '&gt;80', 'F', 'Y']
219
- ]
220
-
221
- </pre>
222
- <p>You can create an ID3 Decision tree to do the dirty job for you:</p>
223
- <pre class="code">
224
-
225
- id3 = ID3.new(DATA_SET, DATA_LABELS)
226
-
227
- </pre>
228
- <p>The Decision tree will automatically create the "rules" to parse new data,
229
- and identify new posible marketing targets:</p>
230
- <pre class="code">
231
-
232
- id3.get_rules
233
- # =&gt; if age_range=='&lt;30' then marketing_target='Y'
234
- elsif age_range=='[30-50)' and city=='Chicago' then marketing_target='Y'
235
- elsif age_range=='[30-50)' and city=='New York' then marketing_target='N'
236
- elsif age_range=='[50-80]' then marketing_target='N'
237
- elsif age_range=='&gt;80' then marketing_target='Y'
238
- else raise 'There was not enough information during training to do a proper induction for this data element' end
239
-
240
- id3.eval(['New York', '&lt;30', 'M'])
241
- # =&gt; 'Y'
242
-
243
- </pre>
244
- </div>
245
-
246
-
247
- <a name="N10035"></a><a name="mach-dataload"></a>
248
- <h2 class="boxed">Better data loading</h2>
249
- <div class="section">
250
- <p>
251
- In real life you will use many more data training examples,
252
- with more attributes.
253
- Consider moving your data to an external CSV (comma separate values) file.
254
- </p>
255
- <pre class="code">
256
-
257
- data_set = []
258
- CSV::Reader.parse(File.open("#{File.dirname(__FILE__)}/data_set.csv", 'r')) do |row|
259
- data_set &lt;&lt; row
260
- end
261
- data_labels = data_set.shift
262
-
263
- id3 = ID3.new(data_set, data_labels)
264
- </pre>
265
- </div>
266
-
267
-
268
- <a name="N10043"></a><a name="mach-eval"></a>
269
- <h2 class="boxed">A good tip for data evaluation</h2>
270
- <div class="section">
271
- <p>
272
- The ID3 class provides a method to evaluate new data.
273
- </p>
274
- <pre class="code">
275
-
276
- id3.eval(['New York', '&lt;30', 'M'])
277
- # =&gt; 'Y'
278
- </pre>
279
- <p>
280
- But instead of going through the tree every time, you can take advantage of the
281
- fact that the method "get_rules" generates proper ruby code!
282
- </p>
283
- <pre class="code">
284
-
285
- id3 = ID3.new(DATA_SET, DATA_LABELS)
286
- age_range = '&lt;30'
287
- city = 'New York'
288
- gender = 'M'
289
- marketing_target = nil
290
- eval id3.get_rules
291
- puts marketing_target
292
- # =&gt; 'Y'
293
- </pre>
294
- </div>
295
-
296
-
297
- <a name="N10058"></a><a name="mach-more"></a>
298
- <h2 class="boxed">More about ID3 and decision trees</h2>
299
- <div class="section">
300
- <p>
301
-
302
- <a class="external" href="http://en.wikipedia.org/wiki/Decision_tree">Wikipedia article on Decision trees</a>
303
- <a class="external" href="http://en.wikipedia.org/wiki/ID3_algorithm">Wikipedia article on ID3 Algorithm</a>
304
-
305
- </p>
306
- </div>
307
-
308
- </div>
309
- <!--+
310
- |end content
311
- +-->
312
- <div class="clearboth">&nbsp;</div>
313
- </div>
314
- <div id="footer">
315
- <!--+
316
- |start bottomstrip
317
- +-->
318
- <div class="lastmodified">
319
- <script type="text/javascript"><!--
320
- document.write("Last Published: " + document.lastModified);
321
- // --></script>
322
- </div>
323
- <div class="copyright">
324
- Copyright &copy;
325
- 2007-2009 <a href="http://www.jadeferret.com/">Sergio Fierens, Jade Ferret</a>
326
- </div>
327
- <div class="host">
328
- <a href="http://rubyforge.org/projects/ai4r/"><img class="logoImage" alt="" src="images/rubyforge.png"></a>
329
- </div>
330
- <!--+
331
- |end bottomstrip
332
- +-->
333
- </div>
334
- <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script><script type="text/javascript">
335
- var pageTracker = _gat._getTracker("UA-3234625-1");
336
- pageTracker._initData();
337
- pageTracker._trackPageview();
338
- </script>
339
- </body>
340
- </html>