ai4r 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +48 -0
- data/examples/decision_trees/data_set.csv +121 -0
- data/examples/decision_trees/id3_example.rb +31 -0
- data/examples/decision_trees/results.txt +29 -0
- data/examples/genetic_algorithm/genetic_algorithm_example.rb +39 -0
- data/examples/genetic_algorithm/travel_cost.csv +16 -0
- data/examples/neural_network/backpropagation_example.rb +65 -0
- data/examples/neural_network/patterns_with_base_noise.rb +68 -0
- data/examples/neural_network/patterns_with_noise.rb +66 -0
- data/examples/neural_network/training_patterns.rb +68 -0
- data/lib/decision_tree/id3.rb +354 -0
- data/lib/genetic_algorithm/genetic_algorithm.rb +268 -0
- data/lib/neural_network/backpropagation.rb +259 -0
- data/site/build/site/en/broken-links.xml +2 -0
- data/site/build/site/en/downloads.html +187 -0
- data/site/build/site/en/downloads.pdf +151 -0
- data/site/build/site/en/geneticAlgorithms.html +564 -0
- data/site/build/site/en/geneticAlgorithms.pdf +911 -0
- data/site/build/site/en/images/ai4r-logo.png +0 -0
- data/site/build/site/en/images/built-with-forrest-button.png +0 -0
- data/site/build/site/en/images/c.png +0 -0
- data/site/build/site/en/images/c_wbn.png +0 -0
- data/site/build/site/en/images/c_wn.png +0 -0
- data/site/build/site/en/images/ero.gif +0 -0
- data/site/build/site/en/images/europe2.png +0 -0
- data/site/build/site/en/images/europe3.png +0 -0
- data/site/build/site/en/images/fitness.png +0 -0
- data/site/build/site/en/images/instruction_arrow.png +0 -0
- data/site/build/site/en/images/my_email.png +0 -0
- data/site/build/site/en/images/rubyforge.png +0 -0
- data/site/build/site/en/images/s.png +0 -0
- data/site/build/site/en/images/s_wbn.png +0 -0
- data/site/build/site/en/images/s_wn.png +0 -0
- data/site/build/site/en/images/sigmoid.png +0 -0
- data/site/build/site/en/images/t.png +0 -0
- data/site/build/site/en/images/t_wbn.png +0 -0
- data/site/build/site/en/images/t_wn.png +0 -0
- data/site/build/site/en/index.html +258 -0
- data/site/build/site/en/index.pdf +306 -0
- data/site/build/site/en/linkmap.html +231 -0
- data/site/build/site/en/linkmap.pdf +94 -0
- data/site/build/site/en/locationmap.xml +72 -0
- data/site/build/site/en/machineLearning.html +325 -0
- data/site/build/site/en/machineLearning.pdf +337 -0
- data/site/build/site/en/neuralNetworks.html +446 -0
- data/site/build/site/en/neuralNetworks.pdf +604 -0
- data/site/build/site/en/skin/CommonMessages_de.xml +23 -0
- data/site/build/site/en/skin/CommonMessages_en_US.xml +23 -0
- data/site/build/site/en/skin/CommonMessages_es.xml +23 -0
- data/site/build/site/en/skin/CommonMessages_fr.xml +23 -0
- data/site/build/site/en/skin/basic.css +166 -0
- data/site/build/site/en/skin/breadcrumbs-optimized.js +90 -0
- data/site/build/site/en/skin/breadcrumbs.js +237 -0
- data/site/build/site/en/skin/fontsize.js +166 -0
- data/site/build/site/en/skin/getBlank.js +40 -0
- data/site/build/site/en/skin/getMenu.js +45 -0
- data/site/build/site/en/skin/images/README.txt +1 -0
- data/site/build/site/en/skin/images/add.jpg +0 -0
- data/site/build/site/en/skin/images/built-with-forrest-button.png +0 -0
- data/site/build/site/en/skin/images/chapter.gif +0 -0
- data/site/build/site/en/skin/images/chapter_open.gif +0 -0
- data/site/build/site/en/skin/images/current.gif +0 -0
- data/site/build/site/en/skin/images/error.png +0 -0
- data/site/build/site/en/skin/images/external-link.gif +0 -0
- data/site/build/site/en/skin/images/fix.jpg +0 -0
- data/site/build/site/en/skin/images/forrest-credit-logo.png +0 -0
- data/site/build/site/en/skin/images/hack.jpg +0 -0
- data/site/build/site/en/skin/images/header_white_line.gif +0 -0
- data/site/build/site/en/skin/images/info.png +0 -0
- data/site/build/site/en/skin/images/instruction_arrow.png +0 -0
- data/site/build/site/en/skin/images/label.gif +0 -0
- data/site/build/site/en/skin/images/page.gif +0 -0
- data/site/build/site/en/skin/images/pdfdoc.gif +0 -0
- data/site/build/site/en/skin/images/poddoc.png +0 -0
- data/site/build/site/en/skin/images/printer.gif +0 -0
- data/site/build/site/en/skin/images/rc-b-l-15-1body-2menu-3menu.png +0 -0
- data/site/build/site/en/skin/images/rc-b-r-15-1body-2menu-3menu.png +0 -0
- data/site/build/site/en/skin/images/rc-b-r-5-1header-2tab-selected-3tab-selected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-l-5-1header-2searchbox-3searchbox.png +0 -0
- data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-selected-3tab-selected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-15-1body-2menu-3menu.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-5-1header-2searchbox-3searchbox.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-selected-3tab-selected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png +0 -0
- data/site/build/site/en/skin/images/remove.jpg +0 -0
- data/site/build/site/en/skin/images/rss.png +0 -0
- data/site/build/site/en/skin/images/spacer.gif +0 -0
- data/site/build/site/en/skin/images/success.png +0 -0
- data/site/build/site/en/skin/images/txtdoc.png +0 -0
- data/site/build/site/en/skin/images/update.jpg +0 -0
- data/site/build/site/en/skin/images/valid-html401.png +0 -0
- data/site/build/site/en/skin/images/vcss.png +0 -0
- data/site/build/site/en/skin/images/warning.png +0 -0
- data/site/build/site/en/skin/images/xmldoc.gif +0 -0
- data/site/build/site/en/skin/menu.js +48 -0
- data/site/build/site/en/skin/note.txt +50 -0
- data/site/build/site/en/skin/print.css +54 -0
- data/site/build/site/en/skin/profile.css +163 -0
- data/site/build/site/en/skin/prototype.js +1257 -0
- data/site/build/site/en/skin/screen.css +587 -0
- data/site/build/site/en/svn.html +223 -0
- data/site/build/site/en/svn.pdf +239 -0
- data/site/build/site/en/wholesite.pdf +1686 -0
- data/site/build/tmp/brokenlinks.xml +2 -0
- data/site/build/tmp/build-info.xml +5 -0
- data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.data +0 -0
- data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.index +0 -0
- data/site/build/tmp/input.xmap +32 -0
- data/site/build/tmp/internal.xmap +32 -0
- data/site/build/tmp/locationmap.xml +29 -0
- data/site/build/tmp/output.xmap +38 -0
- data/site/build/tmp/pluginlist2fetchbuild.xml +144 -0
- data/site/build/tmp/plugins-1.xml +212 -0
- data/site/build/tmp/plugins-2.xml +347 -0
- data/site/build/tmp/projfilters.properties +41 -0
- data/site/build/tmp/resources.xmap +32 -0
- data/site/build/webapp/WEB-INF/logs/access.log +0 -0
- data/site/build/webapp/WEB-INF/logs/core.log +788 -0
- data/site/build/webapp/WEB-INF/logs/debug.log +0 -0
- data/site/build/webapp/WEB-INF/logs/error.log +248 -0
- data/site/build/webapp/WEB-INF/logs/flow.log +0 -0
- data/site/build/webapp/WEB-INF/logs/idgen.log +0 -0
- data/site/build/webapp/WEB-INF/logs/linkrewriter.log +0 -0
- data/site/build/webapp/WEB-INF/logs/locationmap.log +0 -0
- data/site/build/webapp/WEB-INF/logs/sitemap.log +0 -0
- data/site/build/webapp/WEB-INF/logs/xmlform.log +0 -0
- data/site/forrest.properties +152 -0
- data/site/forrest.properties.dispatcher.properties +25 -0
- data/site/forrest.properties.xml +29 -0
- data/site/src/documentation/README.txt +7 -0
- data/site/src/documentation/classes/CatalogManager.properties +62 -0
- data/site/src/documentation/content/locationmap.xml +72 -0
- data/site/src/documentation/content/xdocs/downloads.html +9 -0
- data/site/src/documentation/content/xdocs/geneticAlgorithms.xml +280 -0
- data/site/src/documentation/content/xdocs/index.xml +73 -0
- data/site/src/documentation/content/xdocs/machineLearning.xml +129 -0
- data/site/src/documentation/content/xdocs/neuralNetworks.xml +218 -0
- data/site/src/documentation/content/xdocs/site.xml +51 -0
- data/site/src/documentation/content/xdocs/svn.xml +31 -0
- data/site/src/documentation/content/xdocs/tabs.xml +35 -0
- data/site/src/documentation/resources/images/ai4r-logo.png +0 -0
- data/site/src/documentation/resources/images/c.png +0 -0
- data/site/src/documentation/resources/images/c_wbn.png +0 -0
- data/site/src/documentation/resources/images/c_wn.png +0 -0
- data/site/src/documentation/resources/images/ellipse-2.svg +30 -0
- data/site/src/documentation/resources/images/ero.gif +0 -0
- data/site/src/documentation/resources/images/europe2.png +0 -0
- data/site/src/documentation/resources/images/europe3.png +0 -0
- data/site/src/documentation/resources/images/fitness.png +0 -0
- data/site/src/documentation/resources/images/icon-a.png +0 -0
- data/site/src/documentation/resources/images/icon-b.png +0 -0
- data/site/src/documentation/resources/images/icon.png +0 -0
- data/site/src/documentation/resources/images/my_email.png +0 -0
- data/site/src/documentation/resources/images/project-logo.png +0 -0
- data/site/src/documentation/resources/images/rubyforge.png +0 -0
- data/site/src/documentation/resources/images/s.png +0 -0
- data/site/src/documentation/resources/images/s_wbn.png +0 -0
- data/site/src/documentation/resources/images/s_wn.png +0 -0
- data/site/src/documentation/resources/images/sigmoid.png +0 -0
- data/site/src/documentation/resources/images/sub-dir/icon-c.png +0 -0
- data/site/src/documentation/resources/images/t.png +0 -0
- data/site/src/documentation/resources/images/t_wbn.png +0 -0
- data/site/src/documentation/resources/images/t_wn.png +0 -0
- data/site/src/documentation/resources/schema/catalog.xcat +29 -0
- data/site/src/documentation/resources/schema/hello-v10.dtd +51 -0
- data/site/src/documentation/resources/schema/symbols-project-v10.ent +26 -0
- data/site/src/documentation/resources/stylesheets/hello2document.xsl +33 -0
- data/site/src/documentation/sitemap.xmap +66 -0
- data/site/src/documentation/skinconf.xml +418 -0
- data/site/src/documentation/translations/langcode.xml +29 -0
- data/site/src/documentation/translations/languages_de.xml +24 -0
- data/site/src/documentation/translations/languages_en.xml +24 -0
- data/site/src/documentation/translations/languages_es.xml +22 -0
- data/site/src/documentation/translations/languages_fr.xml +24 -0
- data/site/src/documentation/translations/languages_nl.xml +24 -0
- data/site/src/documentation/translations/menu.xml +33 -0
- data/site/src/documentation/translations/menu_af.xml +33 -0
- data/site/src/documentation/translations/menu_de.xml +33 -0
- data/site/src/documentation/translations/menu_es.xml +33 -0
- data/site/src/documentation/translations/menu_fr.xml +33 -0
- data/site/src/documentation/translations/menu_it.xml +33 -0
- data/site/src/documentation/translations/menu_nl.xml +33 -0
- data/site/src/documentation/translations/menu_no.xml +33 -0
- data/site/src/documentation/translations/menu_ru.xml +33 -0
- data/site/src/documentation/translations/menu_sk.xml +33 -0
- data/site/src/documentation/translations/tabs.xml +22 -0
- data/site/src/documentation/translations/tabs_de.xml +22 -0
- data/site/src/documentation/translations/tabs_es.xml +22 -0
- data/site/src/documentation/translations/tabs_fr.xml +22 -0
- data/site/src/documentation/translations/tabs_nl.xml +22 -0
- data/test/decision_tree/id3_test.rb +209 -0
- data/test/genetic_algorithm/chromosome_test.rb +55 -0
- data/test/genetic_algorithm/genetic_algorithm_test.rb +78 -0
- data/test/neural_network/backpropagation_test.rb +44 -0
- metadata +274 -0
@@ -0,0 +1,231 @@
|
|
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
|
+
<!--+
|
27
|
+
|end group logo
|
28
|
+
+-->
|
29
|
+
<!--+
|
30
|
+
|start Project Logo
|
31
|
+
+-->
|
32
|
+
<div class="projectlogoA1">
|
33
|
+
<a href="http://ai4r.rubyforge.org/"><img class="logoImage" alt="ai4r" src="images/ai4r-logo.png" title="Artificial Intelligence for Ruby"></a>
|
34
|
+
</div>
|
35
|
+
<!--+
|
36
|
+
|end Project Logo
|
37
|
+
+-->
|
38
|
+
<!--+
|
39
|
+
|start Search
|
40
|
+
+-->
|
41
|
+
<div class="searchbox">
|
42
|
+
<div class="roundtopsmall">
|
43
|
+
<form target="_top" action="http://www.google.com/custom" method="get">
|
44
|
+
<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">
|
45
|
+
</form>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
<!--+
|
49
|
+
|end search
|
50
|
+
+-->
|
51
|
+
<!--+
|
52
|
+
|start Tabs
|
53
|
+
+-->
|
54
|
+
<ul id="tabs">
|
55
|
+
<li class="current">
|
56
|
+
<a class="selected" href="index.html">Home</a>
|
57
|
+
</li>
|
58
|
+
</ul>
|
59
|
+
<!--+
|
60
|
+
|end Tabs
|
61
|
+
+-->
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
<div id="main">
|
65
|
+
<div id="publishedStrip">
|
66
|
+
<!--+
|
67
|
+
|start Subtabs
|
68
|
+
+-->
|
69
|
+
<div id="level2tabs"></div>
|
70
|
+
<!--+
|
71
|
+
|end Endtabs
|
72
|
+
+-->
|
73
|
+
<script type="text/javascript"><!--
|
74
|
+
document.write("Last Published: " + document.lastModified);
|
75
|
+
// --></script>
|
76
|
+
</div>
|
77
|
+
<!--+
|
78
|
+
|breadtrail
|
79
|
+
+-->
|
80
|
+
<div class="breadtrail">
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
<!--+
|
85
|
+
|start Menu, mainarea
|
86
|
+
+-->
|
87
|
+
<!--+
|
88
|
+
|start Menu
|
89
|
+
+-->
|
90
|
+
<div id="menu">
|
91
|
+
<div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Home</div>
|
92
|
+
<div id="menu_1.1" class="menuitemgroup">
|
93
|
+
<div class="menuitem">
|
94
|
+
<a href="index.html" title="ai4r - Artificial Intelligence for Ruby">Index</a>
|
95
|
+
</div>
|
96
|
+
<div class="menuitem">
|
97
|
+
<a href="geneticAlgorithms.html" title="Genetic Algorithms in ruby">Genetic Algorithms</a>
|
98
|
+
</div>
|
99
|
+
<div class="menuitem">
|
100
|
+
<a href="machineLearning.html" title="ID3 Decision Trees in ruby">Machine Learning</a>
|
101
|
+
</div>
|
102
|
+
<div class="menuitem">
|
103
|
+
<a href="neuralNetworks.html" title="Backpropagation Neural Network in ruby">Neural Networks</a>
|
104
|
+
</div>
|
105
|
+
<div class="menuitem">
|
106
|
+
<a href="downloads.html" title="ai4r - Download Files">Downloads</a>
|
107
|
+
</div>
|
108
|
+
<div class="menuitem">
|
109
|
+
<a href="svn.html" title="ai4r Subversion repository">Subversion (svn)</a>
|
110
|
+
</div>
|
111
|
+
<div class="menuitem">
|
112
|
+
<a href="wholesite.pdf">ai4r project PDF</a>
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div id="credit">
|
116
|
+
<script type="text/javascript">
|
117
|
+
google_ad_client = "pub-2578934938711895";
|
118
|
+
google_ad_slot = "6111091580";
|
119
|
+
google_ad_width = 125;
|
120
|
+
google_ad_height = 125;
|
121
|
+
</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
|
122
|
+
<hr>
|
123
|
+
</div>
|
124
|
+
<div id="roundbottom">
|
125
|
+
<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
|
126
|
+
<!--+
|
127
|
+
|alternative credits
|
128
|
+
+-->
|
129
|
+
<div id="credit2"></div>
|
130
|
+
</div>
|
131
|
+
<!--+
|
132
|
+
|end Menu
|
133
|
+
+-->
|
134
|
+
<!--+
|
135
|
+
|start content
|
136
|
+
+-->
|
137
|
+
<div id="content">
|
138
|
+
<div title="Portable Document Format" class="pdflink">
|
139
|
+
<a class="dida" href="linkmap.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
|
140
|
+
PDF</a>
|
141
|
+
</div>
|
142
|
+
<h1>Site Linkmap Table of Contents</h1>
|
143
|
+
<p>
|
144
|
+
This is a map of the complete site and its structure.
|
145
|
+
</p>
|
146
|
+
<ul>
|
147
|
+
<li>
|
148
|
+
<a>ai4r</a> ___________________ <em>site</em>
|
149
|
+
</li>
|
150
|
+
<ul>
|
151
|
+
|
152
|
+
<ul>
|
153
|
+
<li>
|
154
|
+
<a>Home</a> ___________________ <em>about</em>
|
155
|
+
</li>
|
156
|
+
<ul>
|
157
|
+
|
158
|
+
<ul>
|
159
|
+
<li>
|
160
|
+
<a href="index.html">Index</a> ___________________ <em>index</em> : ai4r - Artificial Intelligence for Ruby</li>
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
<ul>
|
164
|
+
<li>
|
165
|
+
<a href="geneticAlgorithms.html">Genetic Algorithms</a> ___________________ <em>geneticAlgorithms</em> : Genetic Algorithms in ruby</li>
|
166
|
+
</ul>
|
167
|
+
|
168
|
+
<ul>
|
169
|
+
<li>
|
170
|
+
<a href="machineLearning.html">Machine Learning</a> ___________________ <em>machineLearning</em> : ID3 Decision Trees in ruby</li>
|
171
|
+
</ul>
|
172
|
+
|
173
|
+
<ul>
|
174
|
+
<li>
|
175
|
+
<a href="neuralNetworks.html">Neural Networks</a> ___________________ <em>neuralNetworks</em> : Backpropagation Neural Network in ruby</li>
|
176
|
+
</ul>
|
177
|
+
|
178
|
+
<ul>
|
179
|
+
<li>
|
180
|
+
<a href="downloads.html">Downloads</a> ___________________ <em>download</em> : ai4r - Download Files</li>
|
181
|
+
</ul>
|
182
|
+
|
183
|
+
<ul>
|
184
|
+
<li>
|
185
|
+
<a href="svn.html">Subversion (svn)</a> ___________________ <em>svn</em> : ai4r Subversion repository</li>
|
186
|
+
</ul>
|
187
|
+
|
188
|
+
<ul>
|
189
|
+
<li>
|
190
|
+
<a href="wholesite.pdf">ai4r project PDF</a> ___________________ <em>ai4r_site_pdf</em>
|
191
|
+
</li>
|
192
|
+
</ul>
|
193
|
+
|
194
|
+
</ul>
|
195
|
+
</ul>
|
196
|
+
|
197
|
+
|
198
|
+
</ul>
|
199
|
+
</ul>
|
200
|
+
</div>
|
201
|
+
<!--+
|
202
|
+
|end content
|
203
|
+
+-->
|
204
|
+
<div class="clearboth"> </div>
|
205
|
+
</div>
|
206
|
+
<div id="footer">
|
207
|
+
<!--+
|
208
|
+
|start bottomstrip
|
209
|
+
+-->
|
210
|
+
<div class="lastmodified">
|
211
|
+
<script type="text/javascript"><!--
|
212
|
+
document.write("Last Published: " + document.lastModified);
|
213
|
+
// --></script>
|
214
|
+
</div>
|
215
|
+
<div class="copyright">
|
216
|
+
Copyright ©
|
217
|
+
2007-2008 Sergio Fierens</div>
|
218
|
+
<div class="host">
|
219
|
+
<a href="http://rubyforge.org/projects/ai4r/"><img class="logoImage" alt="" src="images/rubyforge.png"></a>
|
220
|
+
</div>
|
221
|
+
<!--+
|
222
|
+
|end bottomstrip
|
223
|
+
+-->
|
224
|
+
</div>
|
225
|
+
<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script><script type="text/javascript">
|
226
|
+
var pageTracker = _gat._getTracker("UA-3234625-1");
|
227
|
+
pageTracker._initData();
|
228
|
+
pageTracker._trackPageview();
|
229
|
+
</script>
|
230
|
+
</body>
|
231
|
+
</html>
|
@@ -0,0 +1,94 @@
|
|
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 965 /Filter [ /ASCII85Decode /FlateDecode ]
|
9
|
+
>>
|
10
|
+
stream
|
11
|
+
Gat=*_/e9Q'YO;nFA*1<#R$<29B*NW-dB#XDKR<Ob?1X(_*p=trk:q/%60ZOOYc%e^qAL4>0sn,7NWs:5S8N4[MZjC?SR-u3=5k%rk]dpk%FkuVFclOJtHZd>dO%[!l^"!3P4>2BpGmh7$c.KB3d.VpdPV8KW`XR?U=D)+Hmp9*O5o?iYYK/F`?#sf1cV#XIQi]g^^e%\tF]B`d5aC:rq1u@bR6L\JsX>mN?3KWn(o`k`'%ZcTUXR:/[0#>OGFCaGF@nfZ6B-"OXC+S4C`;'%k&b^A[EId5U;$6%Dit?WUW""%4(4;$[a*3+%>I=8?L>@Y4u`.DRA%oB.p?dAJD?AqD/sh*^F-bh:mIS1qs;;re&M/n6O^CcLC8qO9)Xj)e(6)dV+TQ-t&r$_CFCma`A0Wo><<L#]k#<*KEN+d1DP`ZrS8o#GA9HMFOAXscm/M)g[`',+(2_BDpE;K9BTeO)cabbd3c5&Ap2\Cl34NRH1DP/L/S#eK2H7$/mpf&'dc]9=c3=S4.5ia0r\c&3kacGR2&\Ir/3K2%\%!5l_[?$.PRGJ@=<;2ZK3GLX2Ej5Wa#OgXMB'ti\Wd3_eN]j!DdW^qGH]4W)E)Z?8l(TEu1]*p&YVj`Mm=qI17?Si[R1oC9?bMtX;Tlo=:?9G?T>j#\$4h5m]H`)BR7Fo-W!flB#W+8(6Y*ccrbo=I9QuA1[P02:(_!HP'\+)ZRDJ$a9<Z`tV`kBF[@5E7Bb4k&jXF:r6oAS8W>9R6NPOOe@O9/#a[e-TX;EeQgjuMc=SmlJL?Gf\6(rGoGI4*/B26Ql%$>h0)N@2UI,4,j-Tf6qO9ulb5ShIOA5A$ZTD*us!2^+,G9[#rT":u[g-l+@'hac9m,DjY@Y)uCS*"f*0%%CQ'#:Tj&ma,k4qGm'+WGR8I73o5PJhXX\"&gM42P+lbR&KDj<E7_F:$aD\<\sEmk.m;U%mELL9`~>
|
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
|
+
0000001788 00000 n
|
76
|
+
0000001846 00000 n
|
77
|
+
0000001896 00000 n
|
78
|
+
0000000015 00000 n
|
79
|
+
0000000071 00000 n
|
80
|
+
0000001127 00000 n
|
81
|
+
0000001233 00000 n
|
82
|
+
0000001345 00000 n
|
83
|
+
0000001454 00000 n
|
84
|
+
0000001564 00000 n
|
85
|
+
0000001672 00000 n
|
86
|
+
trailer
|
87
|
+
<<
|
88
|
+
/Size 12
|
89
|
+
/Root 2 0 R
|
90
|
+
/Info 4 0 R
|
91
|
+
>>
|
92
|
+
startxref
|
93
|
+
2016
|
94
|
+
%%EOF
|
@@ -0,0 +1,72 @@
|
|
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>
|
@@ -0,0 +1,325 @@
|
|
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
|
+
<!--+
|
27
|
+
|end group logo
|
28
|
+
+-->
|
29
|
+
<!--+
|
30
|
+
|start Project Logo
|
31
|
+
+-->
|
32
|
+
<div class="projectlogoA1">
|
33
|
+
<a href="http://ai4r.rubyforge.org/"><img class="logoImage" alt="ai4r" src="images/ai4r-logo.png" title="Artificial Intelligence for Ruby"></a>
|
34
|
+
</div>
|
35
|
+
<!--+
|
36
|
+
|end Project Logo
|
37
|
+
+-->
|
38
|
+
<!--+
|
39
|
+
|start Search
|
40
|
+
+-->
|
41
|
+
<div class="searchbox">
|
42
|
+
<div class="roundtopsmall">
|
43
|
+
<form target="_top" action="http://www.google.com/custom" method="get">
|
44
|
+
<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">
|
45
|
+
</form>
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
<!--+
|
49
|
+
|end search
|
50
|
+
+-->
|
51
|
+
<!--+
|
52
|
+
|start Tabs
|
53
|
+
+-->
|
54
|
+
<ul id="tabs">
|
55
|
+
<li class="current">
|
56
|
+
<a class="selected" href="index.html">Home</a>
|
57
|
+
</li>
|
58
|
+
</ul>
|
59
|
+
<!--+
|
60
|
+
|end Tabs
|
61
|
+
+-->
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
<div id="main">
|
65
|
+
<div id="publishedStrip">
|
66
|
+
<!--+
|
67
|
+
|start Subtabs
|
68
|
+
+-->
|
69
|
+
<div id="level2tabs"></div>
|
70
|
+
<!--+
|
71
|
+
|end Endtabs
|
72
|
+
+-->
|
73
|
+
<script type="text/javascript"><!--
|
74
|
+
document.write("Last Published: " + document.lastModified);
|
75
|
+
// --></script>
|
76
|
+
</div>
|
77
|
+
<!--+
|
78
|
+
|breadtrail
|
79
|
+
+-->
|
80
|
+
<div class="breadtrail">
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
<!--+
|
85
|
+
|start Menu, mainarea
|
86
|
+
+-->
|
87
|
+
<!--+
|
88
|
+
|start Menu
|
89
|
+
+-->
|
90
|
+
<div id="menu">
|
91
|
+
<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>
|
92
|
+
<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
|
93
|
+
<div class="menuitem">
|
94
|
+
<a href="index.html" title="ai4r - Artificial Intelligence for Ruby">Index</a>
|
95
|
+
</div>
|
96
|
+
<div class="menuitem">
|
97
|
+
<a href="geneticAlgorithms.html" title="Genetic Algorithms in ruby">Genetic Algorithms</a>
|
98
|
+
</div>
|
99
|
+
<div class="menupage">
|
100
|
+
<div class="menupagetitle">Machine Learning</div>
|
101
|
+
</div>
|
102
|
+
<div class="menuitem">
|
103
|
+
<a href="neuralNetworks.html" title="Backpropagation Neural Network in ruby">Neural Networks</a>
|
104
|
+
</div>
|
105
|
+
<div class="menuitem">
|
106
|
+
<a href="downloads.html" title="ai4r - Download Files">Downloads</a>
|
107
|
+
</div>
|
108
|
+
<div class="menuitem">
|
109
|
+
<a href="svn.html" title="ai4r Subversion repository">Subversion (svn)</a>
|
110
|
+
</div>
|
111
|
+
<div class="menuitem">
|
112
|
+
<a href="wholesite.pdf">ai4r project PDF</a>
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div id="credit">
|
116
|
+
<script type="text/javascript">
|
117
|
+
google_ad_client = "pub-2578934938711895";
|
118
|
+
google_ad_slot = "6111091580";
|
119
|
+
google_ad_width = 125;
|
120
|
+
google_ad_height = 125;
|
121
|
+
</script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
|
122
|
+
<hr>
|
123
|
+
</div>
|
124
|
+
<div id="roundbottom">
|
125
|
+
<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
|
126
|
+
<!--+
|
127
|
+
|alternative credits
|
128
|
+
+-->
|
129
|
+
<div id="credit2"></div>
|
130
|
+
</div>
|
131
|
+
<!--+
|
132
|
+
|end Menu
|
133
|
+
+-->
|
134
|
+
<!--+
|
135
|
+
|start content
|
136
|
+
+-->
|
137
|
+
<div id="content">
|
138
|
+
<div title="Portable Document Format" class="pdflink">
|
139
|
+
<a class="dida" href="machineLearning.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
|
140
|
+
PDF</a>
|
141
|
+
</div>
|
142
|
+
<h1>Machine Learning with ID3 Decision Trees in Ruby</h1>
|
143
|
+
<div id="minitoc-area">
|
144
|
+
<ul class="minitoc">
|
145
|
+
<li>
|
146
|
+
<a href="#mach-intro">Introduction to ID3 algorithm</a>
|
147
|
+
</li>
|
148
|
+
<li>
|
149
|
+
<a href="#mach-HowTo">Marketing target strategy example using ID3 Decision Trees in Ruby</a>
|
150
|
+
</li>
|
151
|
+
<li>
|
152
|
+
<a href="#mach-dataload">Better data loading</a>
|
153
|
+
</li>
|
154
|
+
<li>
|
155
|
+
<a href="#mach-eval">A good tip for data evaluation</a>
|
156
|
+
</li>
|
157
|
+
<li>
|
158
|
+
<a href="#mach-more">More about ID3 and decision trees</a>
|
159
|
+
</li>
|
160
|
+
</ul>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<a name="N1000C"></a><a name="mach-intro"></a>
|
164
|
+
<h2 class="boxed">Introduction to ID3 algorithm</h2>
|
165
|
+
<div class="section">
|
166
|
+
<p>
|
167
|
+
This is an implementation of the ID3 algorithm (Quinlan).
|
168
|
+
Given a set of preclassified examples, it builds a top-down
|
169
|
+
induction of decision tree, biased by the information gain and
|
170
|
+
entropy measure.
|
171
|
+
</p>
|
172
|
+
<p>
|
173
|
+
The good thing about this learning method is that humans learns as well.
|
174
|
+
Unlike other ai techniques like nueral networks, this class can
|
175
|
+
generate ruby code with if / else sentences. You
|
176
|
+
can use this to evaluate parameters on realtime, copy paste them in a
|
177
|
+
code, or just read them to learn about your problem domain.
|
178
|
+
</p>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
|
182
|
+
<a name="N10019"></a><a name="mach-HowTo"></a>
|
183
|
+
<h2 class="boxed">Marketing target strategy example using ID3 Decision Trees in Ruby</h2>
|
184
|
+
<div class="section">
|
185
|
+
<p>Let's suppose that you are writtng an application that must identify people as relevant marketing targets or not. The only information that you have es collection of examples:</p>
|
186
|
+
<pre class="code">
|
187
|
+
|
188
|
+
DATA_LABELS = [ 'city', 'age_range', 'gender', 'marketing_target' ]
|
189
|
+
|
190
|
+
DATA_SET = [
|
191
|
+
['New York', '<30', 'M', 'Y'],
|
192
|
+
['Chicago', '<30', 'M', 'Y'],
|
193
|
+
['Chicago', '<30', 'F', 'Y'],
|
194
|
+
['New York', '<30', 'M', 'Y'],
|
195
|
+
['New York', '<30', 'M', 'Y'],
|
196
|
+
['Chicago', '[30-50)', 'M', 'Y'],
|
197
|
+
['New York', '[30-50)', 'F', 'N'],
|
198
|
+
['Chicago', '[30-50)', 'F', 'Y'],
|
199
|
+
['New York', '[30-50)', 'F', 'N'],
|
200
|
+
['Chicago', '[50-80]', 'M', 'N'],
|
201
|
+
['New York', '[50-80]', 'F', 'N'],
|
202
|
+
['New York', '[50-80]', 'M', 'N'],
|
203
|
+
['Chicago', '[50-80]', 'M', 'N'],
|
204
|
+
['New York', '[50-80]', 'F', 'N'],
|
205
|
+
['Chicago', '>80', 'F', 'Y']
|
206
|
+
]
|
207
|
+
|
208
|
+
</pre>
|
209
|
+
<p>You can create an ID3 Decision tree to do the dirty job for you:</p>
|
210
|
+
<pre class="code">
|
211
|
+
|
212
|
+
id3 = DecisionTree::ID3.new(DATA_SET, DATA_LABELS)
|
213
|
+
|
214
|
+
</pre>
|
215
|
+
<p>The Decision tree will automatically create the "rules" to parse new data,
|
216
|
+
and identify new posible marketing targets:</p>
|
217
|
+
<pre class="code">
|
218
|
+
|
219
|
+
id3.to_s
|
220
|
+
# => if age_range=='<30' then marketing_target='Y'
|
221
|
+
elsif age_range=='[30-50)' and city=='Chicago' then marketing_target='Y'
|
222
|
+
elsif age_range=='[30-50)' and city=='New York' then marketing_target='N'
|
223
|
+
elsif age_range=='[50-80]' then marketing_target='N'
|
224
|
+
elsif age_range=='>80' then marketing_target='Y'
|
225
|
+
else raise 'There was not enough information during training to do a proper induction for this data element' end
|
226
|
+
|
227
|
+
id3.eval(['New York', '<30', 'M'])
|
228
|
+
# => 'Y'
|
229
|
+
|
230
|
+
</pre>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
<a name="N10035"></a><a name="mach-dataload"></a>
|
235
|
+
<h2 class="boxed">Better data loading</h2>
|
236
|
+
<div class="section">
|
237
|
+
<p>
|
238
|
+
In the real life you will use lot more data training examples,
|
239
|
+
with more attributes.
|
240
|
+
Consider moving your data to an external CSV (comma separate values) file.
|
241
|
+
</p>
|
242
|
+
<pre class="code">
|
243
|
+
|
244
|
+
data_set = []
|
245
|
+
CSV::Reader.parse(File.open("#{File.dirname(__FILE__)}/data_set.csv", 'r')) do |row|
|
246
|
+
data_set << row
|
247
|
+
end
|
248
|
+
data_labels = data_set.shift
|
249
|
+
|
250
|
+
id3 = DecisionTree::ID3.new(data_set, data_labels)
|
251
|
+
</pre>
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
<a name="N10043"></a><a name="mach-eval"></a>
|
256
|
+
<h2 class="boxed">A good tip for data evaluation</h2>
|
257
|
+
<div class="section">
|
258
|
+
<p>
|
259
|
+
The ID3 class provides a method to evaluate new data.
|
260
|
+
</p>
|
261
|
+
<pre class="code">
|
262
|
+
|
263
|
+
id3.eval(['New York', '<30', 'M'])
|
264
|
+
# => 'Y'
|
265
|
+
</pre>
|
266
|
+
<p>
|
267
|
+
But instead of going through the tree every time, you can take advantage of the fact that the method "to_s" generates proper ruby code!
|
268
|
+
</p>
|
269
|
+
<pre class="code">
|
270
|
+
|
271
|
+
id3 = DecisionTree::ID3.new(DATA_SET, DATA_LABELS)
|
272
|
+
age_range = '<30'
|
273
|
+
city = 'New York'
|
274
|
+
gender = 'M'
|
275
|
+
marketing_target = nil
|
276
|
+
eval id3.to_s
|
277
|
+
puts marketing_target
|
278
|
+
# => 'Y'
|
279
|
+
</pre>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
|
283
|
+
<a name="N10058"></a><a name="mach-more"></a>
|
284
|
+
<h2 class="boxed">More about ID3 and decision trees</h2>
|
285
|
+
<div class="section">
|
286
|
+
<p>
|
287
|
+
|
288
|
+
<a href="http://en.wikipedia.org/wiki/Decision_tree">Wikipedia article on Decision trees</a>
|
289
|
+
<a href="http://en.wikipedia.org/wiki/ID3_algorithm">Wikipedia article on ID3 Algorithm</a>
|
290
|
+
|
291
|
+
</p>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
<!--+
|
296
|
+
|end content
|
297
|
+
+-->
|
298
|
+
<div class="clearboth"> </div>
|
299
|
+
</div>
|
300
|
+
<div id="footer">
|
301
|
+
<!--+
|
302
|
+
|start bottomstrip
|
303
|
+
+-->
|
304
|
+
<div class="lastmodified">
|
305
|
+
<script type="text/javascript"><!--
|
306
|
+
document.write("Last Published: " + document.lastModified);
|
307
|
+
// --></script>
|
308
|
+
</div>
|
309
|
+
<div class="copyright">
|
310
|
+
Copyright ©
|
311
|
+
2007-2008 Sergio Fierens</div>
|
312
|
+
<div class="host">
|
313
|
+
<a href="http://rubyforge.org/projects/ai4r/"><img class="logoImage" alt="" src="images/rubyforge.png"></a>
|
314
|
+
</div>
|
315
|
+
<!--+
|
316
|
+
|end bottomstrip
|
317
|
+
+-->
|
318
|
+
</div>
|
319
|
+
<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script><script type="text/javascript">
|
320
|
+
var pageTracker = _gat._getTracker("UA-3234625-1");
|
321
|
+
pageTracker._initData();
|
322
|
+
pageTracker._trackPageview();
|
323
|
+
</script>
|
324
|
+
</body>
|
325
|
+
</html>
|