cabalist 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/LICENSE +7 -0
- data/README.md +2 -2
- data/doc/Cabalist.html +257 -0
- data/doc/Cabalist/ClassifierGenerator.html +320 -0
- data/doc/Cabalist/Configuration.html +404 -0
- data/doc/Cabalist/Frontend.html +152 -0
- data/doc/Cabalist/InstallGenerator.html +282 -0
- data/doc/Cabalist/ModelAdditions.html +1583 -0
- data/doc/Cabalist/Railtie.html +127 -0
- data/doc/_index.html +158 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +320 -0
- data/doc/file.README.html +182 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +182 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +150 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +206 -0
- data/doc/top-level-namespace.html +103 -0
- data/lib/cabalist.rb +1 -1
- data/lib/cabalist/version.rb +1 -1
- data/lib/generators/cabalist/classifier/classifier_generator.rb +1 -1
- data/lib/generators/cabalist/install/templates/initializers/cabalist.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- metadata +23 -2
@@ -0,0 +1,282 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Cabalist::InstallGenerator
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (I)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Cabalist.html" title="Cabalist (module)">Cabalist</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">InstallGenerator</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: Cabalist::InstallGenerator
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Rails::Generators::Base</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">Rails::Generators::Base</li>
|
75
|
+
|
76
|
+
<li class="next">Cabalist::InstallGenerator</li>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
80
|
+
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">lib/generators/cabalist/install/install_generator.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<h2>
|
106
|
+
Instance Method Summary
|
107
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
108
|
+
</h2>
|
109
|
+
|
110
|
+
<ul class="summary">
|
111
|
+
|
112
|
+
<li class="public ">
|
113
|
+
<span class="summary_signature">
|
114
|
+
|
115
|
+
<a href="#add_route-instance_method" title="#add_route (instance method)">- (Object) <strong>add_route</strong> </a>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
</span>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
129
|
+
|
130
|
+
</li>
|
131
|
+
|
132
|
+
|
133
|
+
<li class="public ">
|
134
|
+
<span class="summary_signature">
|
135
|
+
|
136
|
+
<a href="#copy_assets-instance_method" title="#copy_assets (instance method)">- (Object) <strong>copy_assets</strong> </a>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
</span>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
150
|
+
|
151
|
+
</li>
|
152
|
+
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#copy_initializer-instance_method" title="#copy_initializer (instance method)">- (Object) <strong>copy_initializer</strong> </a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
</ul>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<div id="instance_method_details" class="method_details_list">
|
182
|
+
<h2>Instance Method Details</h2>
|
183
|
+
|
184
|
+
|
185
|
+
<div class="method_details first">
|
186
|
+
<p class="signature first" id="add_route-instance_method">
|
187
|
+
|
188
|
+
- (<tt>Object</tt>) <strong>add_route</strong>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</p><table class="source_code">
|
193
|
+
<tr>
|
194
|
+
<td>
|
195
|
+
<pre class="lines">
|
196
|
+
|
197
|
+
|
198
|
+
21
|
199
|
+
22
|
200
|
+
23</pre>
|
201
|
+
</td>
|
202
|
+
<td>
|
203
|
+
<pre class="code"><span class="info file"># File 'lib/generators/cabalist/install/install_generator.rb', line 21</span>
|
204
|
+
|
205
|
+
<span class='kw'>def</span> <span class='id add_route'>add_route</span>
|
206
|
+
<span class='id route'>route</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>match '/cabalist' => Cabalist::Frontend, :anchor => false, :as => :cabalist</span><span class='tstring_end'>"</span></span>
|
207
|
+
<span class='kw'>end</span></pre>
|
208
|
+
</td>
|
209
|
+
</tr>
|
210
|
+
</table>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div class="method_details ">
|
214
|
+
<p class="signature " id="copy_assets-instance_method">
|
215
|
+
|
216
|
+
- (<tt>Object</tt>) <strong>copy_assets</strong>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
</p><table class="source_code">
|
221
|
+
<tr>
|
222
|
+
<td>
|
223
|
+
<pre class="lines">
|
224
|
+
|
225
|
+
|
226
|
+
17
|
227
|
+
18
|
228
|
+
19</pre>
|
229
|
+
</td>
|
230
|
+
<td>
|
231
|
+
<pre class="code"><span class="info file"># File 'lib/generators/cabalist/install/install_generator.rb', line 17</span>
|
232
|
+
|
233
|
+
<span class='kw'>def</span> <span class='id copy_assets'>copy_assets</span>
|
234
|
+
<span class='id directory'>directory</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>public/</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>public/</span><span class='tstring_end'>"</span></span>
|
235
|
+
<span class='kw'>end</span></pre>
|
236
|
+
</td>
|
237
|
+
</tr>
|
238
|
+
</table>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div class="method_details ">
|
242
|
+
<p class="signature " id="copy_initializer-instance_method">
|
243
|
+
|
244
|
+
- (<tt>Object</tt>) <strong>copy_initializer</strong>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</p><table class="source_code">
|
249
|
+
<tr>
|
250
|
+
<td>
|
251
|
+
<pre class="lines">
|
252
|
+
|
253
|
+
|
254
|
+
12
|
255
|
+
13
|
256
|
+
14
|
257
|
+
15</pre>
|
258
|
+
</td>
|
259
|
+
<td>
|
260
|
+
<pre class="code"><span class="info file"># File 'lib/generators/cabalist/install/install_generator.rb', line 12</span>
|
261
|
+
|
262
|
+
<span class='kw'>def</span> <span class='id copy_initializer'>copy_initializer</span>
|
263
|
+
<span class='id copy_file'>copy_file</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>initializers/cabalist.rb</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
264
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>config/initializers/cabalist.rb</span><span class='tstring_end'>"</span></span>
|
265
|
+
<span class='kw'>end</span></pre>
|
266
|
+
</td>
|
267
|
+
</tr>
|
268
|
+
</table>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
<div id="footer">
|
276
|
+
Generated on Wed Apr 25 00:10:24 2012 by
|
277
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
278
|
+
0.7.2 (ruby-1.9.2).
|
279
|
+
</div>
|
280
|
+
|
281
|
+
</body>
|
282
|
+
</html>
|
@@ -0,0 +1,1583 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Cabalist::ModelAdditions
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (M)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Cabalist.html" title="Cabalist (module)">Cabalist</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">ModelAdditions</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: Cabalist::ModelAdditions
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/cabalist/model_additions.rb</dd>
|
76
|
+
|
77
|
+
</dl>
|
78
|
+
<div class="clear"></div>
|
79
|
+
|
80
|
+
<h2>Overview</h2><div class="docstring">
|
81
|
+
<div class="discussion">
|
82
|
+
<p>
|
83
|
+
Core functionality of Cabalist.
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
This module is a placeholder for methods that are mixed in with
|
87
|
+
ActiveRecord::Base as well as those that are created by calling
|
88
|
+
acts_as_cabalist method from within the class definition of an inheriting
|
89
|
+
class.
|
90
|
+
</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<h2>
|
104
|
+
Class Method Summary
|
105
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
106
|
+
</h2>
|
107
|
+
|
108
|
+
<ul class="summary">
|
109
|
+
|
110
|
+
<li class="public ">
|
111
|
+
<span class="summary_signature">
|
112
|
+
|
113
|
+
<a href="#acts_as_cabalist-class_method" title="acts_as_cabalist (class method)">+ (void) <strong>acts_as_cabalist</strong>(opts = {}) </a>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
</span>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<span class="summary_desc"><div class='inline'><p>
|
127
|
+
Class helper to add Cabalist functionality to a Rails model.
|
128
|
+
</p>
|
129
|
+
</div></span>
|
130
|
+
|
131
|
+
</li>
|
132
|
+
|
133
|
+
|
134
|
+
<li class="public ">
|
135
|
+
<span class="summary_signature">
|
136
|
+
|
137
|
+
<a href="#auto_classified-class_method" title="auto_classified (class method)">+ (ActiveRecord::Relation) <strong>auto_classified</strong> </a>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</span>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<span class="summary_desc"><div class='inline'><p>
|
151
|
+
Automatically classified records.
|
152
|
+
</p>
|
153
|
+
</div></span>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#build_model-class_method" title="build_model (class method)">+ (Ai4r::Classifiers::Object) <strong>build_model</strong> </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<span class="summary_desc"><div class='inline'><p>
|
175
|
+
Build the classification model from scratch.
|
176
|
+
</p>
|
177
|
+
</div></span>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#class_variable_domain-class_method" title="class_variable_domain (class method)">+ (Array) <strong>class_variable_domain</strong> </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'><p>
|
199
|
+
Show possible values for the classification.
|
200
|
+
</p>
|
201
|
+
</div></span>
|
202
|
+
|
203
|
+
</li>
|
204
|
+
|
205
|
+
|
206
|
+
<li class="public ">
|
207
|
+
<span class="summary_signature">
|
208
|
+
|
209
|
+
<a href="#classifier-class_method" title="classifier (class method)">+ (Ai4r::Classifiers::Object) <strong>classifier</strong> </a>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
</span>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'><p>
|
223
|
+
Get the classification model for a given class.
|
224
|
+
</p>
|
225
|
+
</div></span>
|
226
|
+
|
227
|
+
</li>
|
228
|
+
|
229
|
+
|
230
|
+
<li class="public ">
|
231
|
+
<span class="summary_signature">
|
232
|
+
|
233
|
+
<a href="#get_class_variable_name-class_method" title="get_class_variable_name (class method)">+ (Symbol) <strong>get_class_variable_name</strong> </a>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
</span>
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
<span class="summary_desc"><div class='inline'><p>
|
247
|
+
Get name of class variable.
|
248
|
+
</p>
|
249
|
+
</div></span>
|
250
|
+
|
251
|
+
</li>
|
252
|
+
|
253
|
+
|
254
|
+
<li class="public ">
|
255
|
+
<span class="summary_signature">
|
256
|
+
|
257
|
+
<a href="#get_feature_names-class_method" title="get_feature_names (class method)">+ (Array) <strong>get_feature_names</strong> </a>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</span>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="summary_desc"><div class='inline'><p>
|
271
|
+
Get names of feature attributes.
|
272
|
+
</p>
|
273
|
+
</div></span>
|
274
|
+
|
275
|
+
</li>
|
276
|
+
|
277
|
+
|
278
|
+
<li class="public ">
|
279
|
+
<span class="summary_signature">
|
280
|
+
|
281
|
+
<a href="#manually_classified-class_method" title="manually_classified (class method)">+ (ActiveRecord::Relation) <strong>manually_classified</strong> </a>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
</span>
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
<span class="summary_desc"><div class='inline'><p>
|
295
|
+
Manually classified records.
|
296
|
+
</p>
|
297
|
+
</div></span>
|
298
|
+
|
299
|
+
</li>
|
300
|
+
|
301
|
+
|
302
|
+
<li class="public ">
|
303
|
+
<span class="summary_signature">
|
304
|
+
|
305
|
+
<a href="#not_classified-class_method" title="not_classified (class method)">+ (ActiveRecord::Relation) <strong>not_classified</strong> </a>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
</span>
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
<span class="summary_desc"><div class='inline'><p>
|
319
|
+
Records that have not yet been classified.
|
320
|
+
</p>
|
321
|
+
</div></span>
|
322
|
+
|
323
|
+
</li>
|
324
|
+
|
325
|
+
|
326
|
+
</ul>
|
327
|
+
|
328
|
+
<h2>
|
329
|
+
Instance Method Summary
|
330
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
331
|
+
</h2>
|
332
|
+
|
333
|
+
<ul class="summary">
|
334
|
+
|
335
|
+
<li class="public ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#classify-instance_method" title="#classify (instance method)">- (Object) <strong>classify</strong> </a>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<span class="summary_desc"><div class='inline'><p>
|
352
|
+
Get predicted value of the class variable.
|
353
|
+
</p>
|
354
|
+
</div></span>
|
355
|
+
|
356
|
+
</li>
|
357
|
+
|
358
|
+
|
359
|
+
<li class="public ">
|
360
|
+
<span class="summary_signature">
|
361
|
+
|
362
|
+
<a href="#classify%21-instance_method" title="#classify! (instance method)">- (self) <strong>classify!</strong> </a>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</span>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
<span class="summary_desc"><div class='inline'><p>
|
376
|
+
Set the class variable to the value suggested by the classifier.
|
377
|
+
</p>
|
378
|
+
</div></span>
|
379
|
+
|
380
|
+
</li>
|
381
|
+
|
382
|
+
|
383
|
+
<li class="public ">
|
384
|
+
<span class="summary_signature">
|
385
|
+
|
386
|
+
<a href="#get_class_variable-instance_method" title="#get_class_variable (instance method)">- (Object) <strong>get_class_variable</strong> </a>
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
</span>
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
<span class="summary_desc"><div class='inline'><p>
|
400
|
+
Value of the class variable.
|
401
|
+
</p>
|
402
|
+
</div></span>
|
403
|
+
|
404
|
+
</li>
|
405
|
+
|
406
|
+
|
407
|
+
<li class="public ">
|
408
|
+
<span class="summary_signature">
|
409
|
+
|
410
|
+
<a href="#get_features-instance_method" title="#get_features (instance method)">- (Array) <strong>get_features</strong> </a>
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
</span>
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
<span class="summary_desc"><div class='inline'><p>
|
424
|
+
Get an array of features.
|
425
|
+
</p>
|
426
|
+
</div></span>
|
427
|
+
|
428
|
+
</li>
|
429
|
+
|
430
|
+
|
431
|
+
<li class="public ">
|
432
|
+
<span class="summary_signature">
|
433
|
+
|
434
|
+
<a href="#set_class_variable-instance_method" title="#set_class_variable (instance method)">- (Object) <strong>set_class_variable</strong>(new_class_variable) </a>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
</span>
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
<span class="summary_desc"><div class='inline'><p>
|
448
|
+
Set the value of the class variable.
|
449
|
+
</p>
|
450
|
+
</div></span>
|
451
|
+
|
452
|
+
</li>
|
453
|
+
|
454
|
+
|
455
|
+
<li class="public ">
|
456
|
+
<span class="summary_signature">
|
457
|
+
|
458
|
+
<a href="#teach-instance_method" title="#teach (instance method)">- (Object) <strong>teach</strong>(new_class_variable) </a>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
</span>
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
<span class="summary_desc"><div class='inline'><p>
|
472
|
+
Set the value of the class variable.
|
473
|
+
</p>
|
474
|
+
</div></span>
|
475
|
+
|
476
|
+
</li>
|
477
|
+
|
478
|
+
|
479
|
+
<li class="public ">
|
480
|
+
<span class="summary_signature">
|
481
|
+
|
482
|
+
<a href="#train_model-instance_method" title="#train_model (instance method)">- (Ai4r::Classifiers::Object) <strong>train_model</strong> </a>
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
</span>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
<span class="summary_desc"><div class='inline'><p>
|
496
|
+
Build the classification model from scratch and store it in cache.
|
497
|
+
</p>
|
498
|
+
</div></span>
|
499
|
+
|
500
|
+
</li>
|
501
|
+
|
502
|
+
|
503
|
+
</ul>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
<div id="class_method_details" class="method_details_list">
|
509
|
+
<h2>Class Method Details</h2>
|
510
|
+
|
511
|
+
|
512
|
+
<div class="method_details first">
|
513
|
+
<p class="signature first" id="acts_as_cabalist-class_method">
|
514
|
+
|
515
|
+
+ (<tt>void</tt>) <strong>acts_as_cabalist</strong>(opts = {})
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
</p><div class="docstring">
|
520
|
+
<div class="discussion">
|
521
|
+
<p class="note returns_void">This method returns an undefined value.</p><p>
|
522
|
+
Class helper to add Cabalist functionality to a Rails model.
|
523
|
+
</p>
|
524
|
+
|
525
|
+
|
526
|
+
</div>
|
527
|
+
</div>
|
528
|
+
<div class="tags">
|
529
|
+
<h3>Parameters:</h3>
|
530
|
+
<ul class="param">
|
531
|
+
|
532
|
+
<li>
|
533
|
+
|
534
|
+
<span class='name'>opts</span>
|
535
|
+
|
536
|
+
|
537
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
538
|
+
|
539
|
+
|
540
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
541
|
+
|
542
|
+
|
543
|
+
—
|
544
|
+
<div class='inline'><p>
|
545
|
+
An options hash.
|
546
|
+
</p>
|
547
|
+
</div>
|
548
|
+
|
549
|
+
</li>
|
550
|
+
|
551
|
+
</ul>
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
<h3>Options Hash (<tt>opts</tt>):</h3>
|
557
|
+
<ul class="option">
|
558
|
+
|
559
|
+
<li>
|
560
|
+
<span class="name">:features</span>
|
561
|
+
<span class="type">(<tt>Array</tt>)</span>
|
562
|
+
<span class="default">
|
563
|
+
|
564
|
+
— default:
|
565
|
+
<tt>required</tt>
|
566
|
+
|
567
|
+
</span>
|
568
|
+
— <div class='inline'><p>
|
569
|
+
Array of symbols representing name of the model attributes used as features
|
570
|
+
(predictors) to train the classifier.
|
571
|
+
</p>
|
572
|
+
</div>
|
573
|
+
</tr>
|
574
|
+
|
575
|
+
<li>
|
576
|
+
<span class="name">:class_variable</span>
|
577
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
578
|
+
<span class="default">
|
579
|
+
|
580
|
+
— default:
|
581
|
+
<tt>required</tt>
|
582
|
+
|
583
|
+
</span>
|
584
|
+
— <div class='inline'><p>
|
585
|
+
Symbol representing the name of the model attribute to be predicted by the
|
586
|
+
classifier.
|
587
|
+
</p>
|
588
|
+
</div>
|
589
|
+
</tr>
|
590
|
+
|
591
|
+
<li>
|
592
|
+
<span class="name">:collection</span>
|
593
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
594
|
+
<span class="default">
|
595
|
+
|
596
|
+
— default:
|
597
|
+
<tt>optional</tt>
|
598
|
+
|
599
|
+
</span>
|
600
|
+
— <div class='inline'><p>
|
601
|
+
Symbol representing the class method used to pull data to be used to train
|
602
|
+
the classifier. By default, the method used will be :manually_classified
|
603
|
+
which is a scope added by this helper call. Anything returning either an
|
604
|
+
ActiveRecord::Relation or an Array of objects of this given class will do.
|
605
|
+
</p>
|
606
|
+
</div>
|
607
|
+
</tr>
|
608
|
+
|
609
|
+
<li>
|
610
|
+
<span class="name">:algorithm</span>
|
611
|
+
<span class="type">(<tt>Symbol</tt>)</span>
|
612
|
+
<span class="default">
|
613
|
+
|
614
|
+
— default:
|
615
|
+
<tt>optional</tt>
|
616
|
+
|
617
|
+
</span>
|
618
|
+
— <div class='inline'><p>
|
619
|
+
Symbol representing the algorithm to be used by the classifier. The library
|
620
|
+
currently supports a number of algorithms provided by the ai4r gem.
|
621
|
+
Accepted values are as following:
|
622
|
+
</p>
|
623
|
+
<ul>
|
624
|
+
<li><p>
|
625
|
+
:hyperpipes for Hyperpipes
|
626
|
+
</p>
|
627
|
+
</li>
|
628
|
+
<li><p>
|
629
|
+
:ib1 for Simple Instance Based Learning
|
630
|
+
</p>
|
631
|
+
</li>
|
632
|
+
<li><p>
|
633
|
+
:id3 for Iterative Dichotomiser 3
|
634
|
+
</p>
|
635
|
+
</li>
|
636
|
+
<li><p>
|
637
|
+
:one_r for One Attribute Rule
|
638
|
+
</p>
|
639
|
+
</li>
|
640
|
+
<li><p>
|
641
|
+
:prism for PRISM
|
642
|
+
</p>
|
643
|
+
</li>
|
644
|
+
<li><p>
|
645
|
+
:zero_r for ZeroR
|
646
|
+
</p>
|
647
|
+
</li>
|
648
|
+
</ul>
|
649
|
+
</div>
|
650
|
+
</tr>
|
651
|
+
|
652
|
+
</ul>
|
653
|
+
|
654
|
+
|
655
|
+
</div><table class="source_code">
|
656
|
+
<tr>
|
657
|
+
<td>
|
658
|
+
<pre class="lines">
|
659
|
+
|
660
|
+
|
661
|
+
39</pre>
|
662
|
+
</td>
|
663
|
+
<td>
|
664
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 39</span>
|
665
|
+
|
666
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id acts_as_cabalist'>acts_as_cabalist</span><span class='lparen'>(</span><span class='id opts'>opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
667
|
+
</td>
|
668
|
+
</tr>
|
669
|
+
</table>
|
670
|
+
</div>
|
671
|
+
|
672
|
+
<div class="method_details ">
|
673
|
+
<p class="signature " id="auto_classified-class_method">
|
674
|
+
|
675
|
+
+ (<tt>ActiveRecord::Relation</tt>) <strong>auto_classified</strong>
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
</p><div class="docstring">
|
680
|
+
<div class="discussion">
|
681
|
+
<p>
|
682
|
+
Automatically classified records.
|
683
|
+
</p>
|
684
|
+
<p>
|
685
|
+
Named scope which returns objects that were classified automatically. That
|
686
|
+
means they have their class variable value set as well as non-nil value of
|
687
|
+
autoclassified_at attribute.
|
688
|
+
</p>
|
689
|
+
|
690
|
+
|
691
|
+
</div>
|
692
|
+
</div>
|
693
|
+
<div class="tags">
|
694
|
+
<h3>Returns:</h3>
|
695
|
+
<ul class="return">
|
696
|
+
|
697
|
+
<li>
|
698
|
+
|
699
|
+
|
700
|
+
<span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
</li>
|
705
|
+
|
706
|
+
</ul>
|
707
|
+
|
708
|
+
</div><table class="source_code">
|
709
|
+
<tr>
|
710
|
+
<td>
|
711
|
+
<pre class="lines">
|
712
|
+
|
713
|
+
|
714
|
+
57</pre>
|
715
|
+
</td>
|
716
|
+
<td>
|
717
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 57</span>
|
718
|
+
|
719
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id auto_classified'>auto_classified</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
720
|
+
</td>
|
721
|
+
</tr>
|
722
|
+
</table>
|
723
|
+
</div>
|
724
|
+
|
725
|
+
<div class="method_details ">
|
726
|
+
<p class="signature " id="build_model-class_method">
|
727
|
+
|
728
|
+
+ (<tt>Ai4r::Classifiers::Object</tt>) <strong>build_model</strong>
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
</p><div class="docstring">
|
733
|
+
<div class="discussion">
|
734
|
+
<p>
|
735
|
+
Build the classification model from scratch.
|
736
|
+
</p>
|
737
|
+
<p>
|
738
|
+
You should probably not use this method directly as it will go ahead and
|
739
|
+
compute the classifier anew each and every time instead of looking at any
|
740
|
+
cached versions.
|
741
|
+
</p>
|
742
|
+
|
743
|
+
|
744
|
+
</div>
|
745
|
+
</div>
|
746
|
+
<div class="tags">
|
747
|
+
<h3>Returns:</h3>
|
748
|
+
<ul class="return">
|
749
|
+
|
750
|
+
<li>
|
751
|
+
|
752
|
+
|
753
|
+
<span class='type'>(<tt>Ai4r::Classifiers::Object</tt>)</span>
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
—
|
758
|
+
<div class='inline'><p>
|
759
|
+
one of classifiers from the Ai4r::Classifiers module, depending on the
|
760
|
+
value (and presence) of the :algorithm option in the acts_as_cabalist
|
761
|
+
method call.
|
762
|
+
</p>
|
763
|
+
</div>
|
764
|
+
|
765
|
+
</li>
|
766
|
+
|
767
|
+
</ul>
|
768
|
+
|
769
|
+
</div><table class="source_code">
|
770
|
+
<tr>
|
771
|
+
<td>
|
772
|
+
<pre class="lines">
|
773
|
+
|
774
|
+
|
775
|
+
121</pre>
|
776
|
+
</td>
|
777
|
+
<td>
|
778
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 121</span>
|
779
|
+
|
780
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id build_model'>build_model</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
781
|
+
</td>
|
782
|
+
</tr>
|
783
|
+
</table>
|
784
|
+
</div>
|
785
|
+
|
786
|
+
<div class="method_details ">
|
787
|
+
<p class="signature " id="class_variable_domain-class_method">
|
788
|
+
|
789
|
+
+ (<tt>Array</tt>) <strong>class_variable_domain</strong>
|
790
|
+
|
791
|
+
|
792
|
+
|
793
|
+
</p><div class="docstring">
|
794
|
+
<div class="discussion">
|
795
|
+
<p>
|
796
|
+
Show possible values for the classification.
|
797
|
+
</p>
|
798
|
+
<p>
|
799
|
+
This method will return all unique values of the class variable that the
|
800
|
+
classifier knows about. If any new values have been added after the
|
801
|
+
classifier has last been retrained, they will not find their way here.
|
802
|
+
</p>
|
803
|
+
|
804
|
+
|
805
|
+
</div>
|
806
|
+
</div>
|
807
|
+
<div class="tags">
|
808
|
+
<h3>Returns:</h3>
|
809
|
+
<ul class="return">
|
810
|
+
|
811
|
+
<li>
|
812
|
+
|
813
|
+
|
814
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
815
|
+
|
816
|
+
|
817
|
+
|
818
|
+
—
|
819
|
+
<div class='inline'><p>
|
820
|
+
an Array containing all unique class variable values.
|
821
|
+
</p>
|
822
|
+
</div>
|
823
|
+
|
824
|
+
</li>
|
825
|
+
|
826
|
+
</ul>
|
827
|
+
|
828
|
+
</div><table class="source_code">
|
829
|
+
<tr>
|
830
|
+
<td>
|
831
|
+
<pre class="lines">
|
832
|
+
|
833
|
+
|
834
|
+
151</pre>
|
835
|
+
</td>
|
836
|
+
<td>
|
837
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 151</span>
|
838
|
+
|
839
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id class_variable_domain'>class_variable_domain</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
840
|
+
</td>
|
841
|
+
</tr>
|
842
|
+
</table>
|
843
|
+
</div>
|
844
|
+
|
845
|
+
<div class="method_details ">
|
846
|
+
<p class="signature " id="classifier-class_method">
|
847
|
+
|
848
|
+
+ (<tt>Ai4r::Classifiers::Object</tt>) <strong>classifier</strong>
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
</p><div class="docstring">
|
853
|
+
<div class="discussion">
|
854
|
+
<p>
|
855
|
+
Get the classification model for a given class.
|
856
|
+
</p>
|
857
|
+
<p>
|
858
|
+
This method will try to find a ready model in the local cache but having
|
859
|
+
failed that will resort to the ‘train_model’ to create one.
|
860
|
+
</p>
|
861
|
+
|
862
|
+
|
863
|
+
</div>
|
864
|
+
</div>
|
865
|
+
<div class="tags">
|
866
|
+
<h3>Returns:</h3>
|
867
|
+
<ul class="return">
|
868
|
+
|
869
|
+
<li>
|
870
|
+
|
871
|
+
|
872
|
+
<span class='type'>(<tt>Ai4r::Classifiers::Object</tt>)</span>
|
873
|
+
|
874
|
+
|
875
|
+
|
876
|
+
—
|
877
|
+
<div class='inline'><p>
|
878
|
+
one of classifiers from the Ai4r::Classifiers module, depending on the
|
879
|
+
value (and presence) of the :algorithm option in the acts_as_cabalist
|
880
|
+
method call.
|
881
|
+
</p>
|
882
|
+
</div>
|
883
|
+
|
884
|
+
</li>
|
885
|
+
|
886
|
+
</ul>
|
887
|
+
|
888
|
+
</div><table class="source_code">
|
889
|
+
<tr>
|
890
|
+
<td>
|
891
|
+
<pre class="lines">
|
892
|
+
|
893
|
+
|
894
|
+
142</pre>
|
895
|
+
</td>
|
896
|
+
<td>
|
897
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 142</span>
|
898
|
+
|
899
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id classifier'>classifier</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
900
|
+
</td>
|
901
|
+
</tr>
|
902
|
+
</table>
|
903
|
+
</div>
|
904
|
+
|
905
|
+
<div class="method_details ">
|
906
|
+
<p class="signature " id="get_class_variable_name-class_method">
|
907
|
+
|
908
|
+
+ (<tt>Symbol</tt>) <strong>get_class_variable_name</strong>
|
909
|
+
|
910
|
+
|
911
|
+
|
912
|
+
</p><div class="docstring">
|
913
|
+
<div class="discussion">
|
914
|
+
<p>
|
915
|
+
Get name of class variable.
|
916
|
+
</p>
|
917
|
+
<p>
|
918
|
+
This method returns the class variable name (as symbol) as it has been
|
919
|
+
passed to the acts_as_cabalist method call as :class_variable option.
|
920
|
+
</p>
|
921
|
+
|
922
|
+
|
923
|
+
</div>
|
924
|
+
</div>
|
925
|
+
<div class="tags">
|
926
|
+
<h3>Returns:</h3>
|
927
|
+
<ul class="return">
|
928
|
+
|
929
|
+
<li>
|
930
|
+
|
931
|
+
|
932
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
933
|
+
|
934
|
+
|
935
|
+
|
936
|
+
</li>
|
937
|
+
|
938
|
+
</ul>
|
939
|
+
|
940
|
+
</div><table class="source_code">
|
941
|
+
<tr>
|
942
|
+
<td>
|
943
|
+
<pre class="lines">
|
944
|
+
|
945
|
+
|
946
|
+
110</pre>
|
947
|
+
</td>
|
948
|
+
<td>
|
949
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 110</span>
|
950
|
+
|
951
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id get_class_variable_name'>get_class_variable_name</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
952
|
+
</td>
|
953
|
+
</tr>
|
954
|
+
</table>
|
955
|
+
</div>
|
956
|
+
|
957
|
+
<div class="method_details ">
|
958
|
+
<p class="signature " id="get_feature_names-class_method">
|
959
|
+
|
960
|
+
+ (<tt>Array</tt>) <strong>get_feature_names</strong>
|
961
|
+
|
962
|
+
|
963
|
+
|
964
|
+
</p><div class="docstring">
|
965
|
+
<div class="discussion">
|
966
|
+
<p>
|
967
|
+
Get names of feature attributes.
|
968
|
+
</p>
|
969
|
+
<p>
|
970
|
+
This method returns the Array of attribute names (as symbols) as they have
|
971
|
+
been passed to the acts_as_cabalist method call as :features option.
|
972
|
+
</p>
|
973
|
+
|
974
|
+
|
975
|
+
</div>
|
976
|
+
</div>
|
977
|
+
<div class="tags">
|
978
|
+
<h3>Returns:</h3>
|
979
|
+
<ul class="return">
|
980
|
+
|
981
|
+
<li>
|
982
|
+
|
983
|
+
|
984
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
985
|
+
|
986
|
+
|
987
|
+
|
988
|
+
—
|
989
|
+
<div class='inline'><p>
|
990
|
+
an Array of symbols representing feature names
|
991
|
+
</p>
|
992
|
+
</div>
|
993
|
+
|
994
|
+
</li>
|
995
|
+
|
996
|
+
</ul>
|
997
|
+
|
998
|
+
</div><table class="source_code">
|
999
|
+
<tr>
|
1000
|
+
<td>
|
1001
|
+
<pre class="lines">
|
1002
|
+
|
1003
|
+
|
1004
|
+
102</pre>
|
1005
|
+
</td>
|
1006
|
+
<td>
|
1007
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 102</span>
|
1008
|
+
|
1009
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id get_feature_names'>get_feature_names</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1010
|
+
</td>
|
1011
|
+
</tr>
|
1012
|
+
</table>
|
1013
|
+
</div>
|
1014
|
+
|
1015
|
+
<div class="method_details ">
|
1016
|
+
<p class="signature " id="manually_classified-class_method">
|
1017
|
+
|
1018
|
+
+ (<tt>ActiveRecord::Relation</tt>) <strong>manually_classified</strong>
|
1019
|
+
|
1020
|
+
|
1021
|
+
|
1022
|
+
</p><div class="docstring">
|
1023
|
+
<div class="discussion">
|
1024
|
+
<p>
|
1025
|
+
Manually classified records.
|
1026
|
+
</p>
|
1027
|
+
<p>
|
1028
|
+
Named scope which returns objects that were classified but not
|
1029
|
+
automatically, that is they have their class variable value set but
|
1030
|
+
autoclassified_at nil.
|
1031
|
+
</p>
|
1032
|
+
|
1033
|
+
|
1034
|
+
</div>
|
1035
|
+
</div>
|
1036
|
+
<div class="tags">
|
1037
|
+
<h3>Returns:</h3>
|
1038
|
+
<ul class="return">
|
1039
|
+
|
1040
|
+
<li>
|
1041
|
+
|
1042
|
+
|
1043
|
+
<span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
|
1044
|
+
|
1045
|
+
|
1046
|
+
|
1047
|
+
</li>
|
1048
|
+
|
1049
|
+
</ul>
|
1050
|
+
|
1051
|
+
</div><table class="source_code">
|
1052
|
+
<tr>
|
1053
|
+
<td>
|
1054
|
+
<pre class="lines">
|
1055
|
+
|
1056
|
+
|
1057
|
+
48</pre>
|
1058
|
+
</td>
|
1059
|
+
<td>
|
1060
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 48</span>
|
1061
|
+
|
1062
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id manually_classified'>manually_classified</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1063
|
+
</td>
|
1064
|
+
</tr>
|
1065
|
+
</table>
|
1066
|
+
</div>
|
1067
|
+
|
1068
|
+
<div class="method_details ">
|
1069
|
+
<p class="signature " id="not_classified-class_method">
|
1070
|
+
|
1071
|
+
+ (<tt>ActiveRecord::Relation</tt>) <strong>not_classified</strong>
|
1072
|
+
|
1073
|
+
|
1074
|
+
|
1075
|
+
</p><div class="docstring">
|
1076
|
+
<div class="discussion">
|
1077
|
+
<p>
|
1078
|
+
Records that have not yet been classified.
|
1079
|
+
</p>
|
1080
|
+
<p>
|
1081
|
+
Named scope which returns objects that were classified automatically. That
|
1082
|
+
means they have their class variable value set as well as non-nil value of
|
1083
|
+
autoclassified_at attribute.
|
1084
|
+
</p>
|
1085
|
+
|
1086
|
+
|
1087
|
+
</div>
|
1088
|
+
</div>
|
1089
|
+
<div class="tags">
|
1090
|
+
<h3>Returns:</h3>
|
1091
|
+
<ul class="return">
|
1092
|
+
|
1093
|
+
<li>
|
1094
|
+
|
1095
|
+
|
1096
|
+
<span class='type'>(<tt>ActiveRecord::Relation</tt>)</span>
|
1097
|
+
|
1098
|
+
|
1099
|
+
|
1100
|
+
</li>
|
1101
|
+
|
1102
|
+
</ul>
|
1103
|
+
|
1104
|
+
</div><table class="source_code">
|
1105
|
+
<tr>
|
1106
|
+
<td>
|
1107
|
+
<pre class="lines">
|
1108
|
+
|
1109
|
+
|
1110
|
+
66</pre>
|
1111
|
+
</td>
|
1112
|
+
<td>
|
1113
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 66</span>
|
1114
|
+
|
1115
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id not_classified'>not_classified</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1116
|
+
</td>
|
1117
|
+
</tr>
|
1118
|
+
</table>
|
1119
|
+
</div>
|
1120
|
+
|
1121
|
+
</div>
|
1122
|
+
|
1123
|
+
<div id="instance_method_details" class="method_details_list">
|
1124
|
+
<h2>Instance Method Details</h2>
|
1125
|
+
|
1126
|
+
|
1127
|
+
<div class="method_details first">
|
1128
|
+
<p class="signature first" id="classify-instance_method">
|
1129
|
+
|
1130
|
+
- (<tt>Object</tt>) <strong>classify</strong>
|
1131
|
+
|
1132
|
+
|
1133
|
+
|
1134
|
+
</p><div class="docstring">
|
1135
|
+
<div class="discussion">
|
1136
|
+
<p>
|
1137
|
+
Get predicted value of the class variable
|
1138
|
+
</p>
|
1139
|
+
<p>
|
1140
|
+
This method will query the classifier of the instance’s corresponding
|
1141
|
+
class for the predicted classification of this instance, given the value of
|
1142
|
+
its features.
|
1143
|
+
</p>
|
1144
|
+
|
1145
|
+
|
1146
|
+
</div>
|
1147
|
+
</div>
|
1148
|
+
<div class="tags">
|
1149
|
+
<h3>Returns:</h3>
|
1150
|
+
<ul class="return">
|
1151
|
+
|
1152
|
+
<li>
|
1153
|
+
|
1154
|
+
|
1155
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1156
|
+
|
1157
|
+
|
1158
|
+
|
1159
|
+
—
|
1160
|
+
<div class='inline'><p>
|
1161
|
+
predicted value of the class variable
|
1162
|
+
</p>
|
1163
|
+
</div>
|
1164
|
+
|
1165
|
+
</li>
|
1166
|
+
|
1167
|
+
</ul>
|
1168
|
+
|
1169
|
+
</div><table class="source_code">
|
1170
|
+
<tr>
|
1171
|
+
<td>
|
1172
|
+
<pre class="lines">
|
1173
|
+
|
1174
|
+
|
1175
|
+
160</pre>
|
1176
|
+
</td>
|
1177
|
+
<td>
|
1178
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 160</span>
|
1179
|
+
|
1180
|
+
<span class='kw'>def</span> <span class='id classify'>classify</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1181
|
+
</td>
|
1182
|
+
</tr>
|
1183
|
+
</table>
|
1184
|
+
</div>
|
1185
|
+
|
1186
|
+
<div class="method_details ">
|
1187
|
+
<p class="signature " id="classify!-instance_method">
|
1188
|
+
|
1189
|
+
- (<tt>self</tt>) <strong>classify!</strong>
|
1190
|
+
|
1191
|
+
|
1192
|
+
|
1193
|
+
</p><div class="docstring">
|
1194
|
+
<div class="discussion">
|
1195
|
+
<p>
|
1196
|
+
Set the class variable to the value suggested by the classifier
|
1197
|
+
</p>
|
1198
|
+
<p>
|
1199
|
+
This method will query the classifier of the instance’s corresponding
|
1200
|
+
class for the predicted classification of this instance, given the value of
|
1201
|
+
its features and then set the class variable to that value.
|
1202
|
+
</p>
|
1203
|
+
|
1204
|
+
|
1205
|
+
</div>
|
1206
|
+
</div>
|
1207
|
+
<div class="tags">
|
1208
|
+
<h3>Returns:</h3>
|
1209
|
+
<ul class="return">
|
1210
|
+
|
1211
|
+
<li>
|
1212
|
+
|
1213
|
+
|
1214
|
+
<span class='type'>(<tt>self</tt>)</span>
|
1215
|
+
|
1216
|
+
|
1217
|
+
|
1218
|
+
—
|
1219
|
+
<div class='inline'><p>
|
1220
|
+
the current object instance
|
1221
|
+
</p>
|
1222
|
+
</div>
|
1223
|
+
|
1224
|
+
</li>
|
1225
|
+
|
1226
|
+
</ul>
|
1227
|
+
|
1228
|
+
</div><table class="source_code">
|
1229
|
+
<tr>
|
1230
|
+
<td>
|
1231
|
+
<pre class="lines">
|
1232
|
+
|
1233
|
+
|
1234
|
+
169</pre>
|
1235
|
+
</td>
|
1236
|
+
<td>
|
1237
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 169</span>
|
1238
|
+
|
1239
|
+
<span class='kw'>def</span> <span class='id classify!'>classify!</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1240
|
+
</td>
|
1241
|
+
</tr>
|
1242
|
+
</table>
|
1243
|
+
</div>
|
1244
|
+
|
1245
|
+
<div class="method_details ">
|
1246
|
+
<p class="signature " id="get_class_variable-instance_method">
|
1247
|
+
|
1248
|
+
- (<tt>Object</tt>) <strong>get_class_variable</strong>
|
1249
|
+
|
1250
|
+
|
1251
|
+
|
1252
|
+
</p><div class="docstring">
|
1253
|
+
<div class="discussion">
|
1254
|
+
<p>
|
1255
|
+
Value of the class variable.
|
1256
|
+
</p>
|
1257
|
+
<p>
|
1258
|
+
This method returns the value of an attribute passed as the :class_variable
|
1259
|
+
option of the acts_as_cabalist method call.
|
1260
|
+
</p>
|
1261
|
+
|
1262
|
+
|
1263
|
+
</div>
|
1264
|
+
</div>
|
1265
|
+
<div class="tags">
|
1266
|
+
<h3>Returns:</h3>
|
1267
|
+
<ul class="return">
|
1268
|
+
|
1269
|
+
<li>
|
1270
|
+
|
1271
|
+
|
1272
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1273
|
+
|
1274
|
+
|
1275
|
+
|
1276
|
+
—
|
1277
|
+
<div class='inline'><p>
|
1278
|
+
the value of the class variable
|
1279
|
+
</p>
|
1280
|
+
</div>
|
1281
|
+
|
1282
|
+
</li>
|
1283
|
+
|
1284
|
+
</ul>
|
1285
|
+
|
1286
|
+
</div><table class="source_code">
|
1287
|
+
<tr>
|
1288
|
+
<td>
|
1289
|
+
<pre class="lines">
|
1290
|
+
|
1291
|
+
|
1292
|
+
84</pre>
|
1293
|
+
</td>
|
1294
|
+
<td>
|
1295
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 84</span>
|
1296
|
+
|
1297
|
+
<span class='kw'>def</span> <span class='id get_class_variable'>get_class_variable</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1298
|
+
</td>
|
1299
|
+
</tr>
|
1300
|
+
</table>
|
1301
|
+
</div>
|
1302
|
+
|
1303
|
+
<div class="method_details ">
|
1304
|
+
<p class="signature " id="get_features-instance_method">
|
1305
|
+
|
1306
|
+
- (<tt>Array</tt>) <strong>get_features</strong>
|
1307
|
+
|
1308
|
+
|
1309
|
+
|
1310
|
+
</p><div class="docstring">
|
1311
|
+
<div class="discussion">
|
1312
|
+
<p>
|
1313
|
+
Get an array of features.
|
1314
|
+
</p>
|
1315
|
+
<p>
|
1316
|
+
Returns an Array of values which result from methods passed as the :feature
|
1317
|
+
option of the acts_as_cabalist method call. Each of this methods is called
|
1318
|
+
upon current instance and results are returned.
|
1319
|
+
</p>
|
1320
|
+
|
1321
|
+
|
1322
|
+
</div>
|
1323
|
+
</div>
|
1324
|
+
<div class="tags">
|
1325
|
+
<h3>Returns:</h3>
|
1326
|
+
<ul class="return">
|
1327
|
+
|
1328
|
+
<li>
|
1329
|
+
|
1330
|
+
|
1331
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1332
|
+
|
1333
|
+
|
1334
|
+
|
1335
|
+
—
|
1336
|
+
<div class='inline'><p>
|
1337
|
+
array of values corresponding to attributes selected as features
|
1338
|
+
</p>
|
1339
|
+
</div>
|
1340
|
+
|
1341
|
+
</li>
|
1342
|
+
|
1343
|
+
</ul>
|
1344
|
+
|
1345
|
+
</div><table class="source_code">
|
1346
|
+
<tr>
|
1347
|
+
<td>
|
1348
|
+
<pre class="lines">
|
1349
|
+
|
1350
|
+
|
1351
|
+
76</pre>
|
1352
|
+
</td>
|
1353
|
+
<td>
|
1354
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 76</span>
|
1355
|
+
|
1356
|
+
<span class='kw'>def</span> <span class='id get_features'>get_features</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1357
|
+
</td>
|
1358
|
+
</tr>
|
1359
|
+
</table>
|
1360
|
+
</div>
|
1361
|
+
|
1362
|
+
<div class="method_details ">
|
1363
|
+
<p class="signature " id="set_class_variable-instance_method">
|
1364
|
+
|
1365
|
+
- (<tt>Object</tt>) <strong>set_class_variable</strong>(new_class_variable)
|
1366
|
+
|
1367
|
+
|
1368
|
+
|
1369
|
+
</p><div class="docstring">
|
1370
|
+
<div class="discussion">
|
1371
|
+
<p>
|
1372
|
+
Set the value of the class variable.
|
1373
|
+
</p>
|
1374
|
+
<p>
|
1375
|
+
This method sets the value of an attribute passed as the :class_variable
|
1376
|
+
option of the acts_as_cabalist method call to the new value.
|
1377
|
+
</p>
|
1378
|
+
|
1379
|
+
|
1380
|
+
</div>
|
1381
|
+
</div>
|
1382
|
+
<div class="tags">
|
1383
|
+
<h3>Parameters:</h3>
|
1384
|
+
<ul class="param">
|
1385
|
+
|
1386
|
+
<li>
|
1387
|
+
|
1388
|
+
<span class='name'>new_class_variable</span>
|
1389
|
+
|
1390
|
+
|
1391
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1392
|
+
|
1393
|
+
|
1394
|
+
|
1395
|
+
—
|
1396
|
+
<div class='inline'><p>
|
1397
|
+
the new value of the class variable
|
1398
|
+
</p>
|
1399
|
+
</div>
|
1400
|
+
|
1401
|
+
</li>
|
1402
|
+
|
1403
|
+
</ul>
|
1404
|
+
<h3>Returns:</h3>
|
1405
|
+
<ul class="return">
|
1406
|
+
|
1407
|
+
<li>
|
1408
|
+
|
1409
|
+
|
1410
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1411
|
+
|
1412
|
+
|
1413
|
+
|
1414
|
+
</li>
|
1415
|
+
|
1416
|
+
</ul>
|
1417
|
+
|
1418
|
+
</div><table class="source_code">
|
1419
|
+
<tr>
|
1420
|
+
<td>
|
1421
|
+
<pre class="lines">
|
1422
|
+
|
1423
|
+
|
1424
|
+
94</pre>
|
1425
|
+
</td>
|
1426
|
+
<td>
|
1427
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 94</span>
|
1428
|
+
|
1429
|
+
<span class='kw'>def</span> <span class='id set_class_variable'>set_class_variable</span><span class='lparen'>(</span><span class='id new_class_variable'>new_class_variable</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1430
|
+
</td>
|
1431
|
+
</tr>
|
1432
|
+
</table>
|
1433
|
+
</div>
|
1434
|
+
|
1435
|
+
<div class="method_details ">
|
1436
|
+
<p class="signature " id="teach-instance_method">
|
1437
|
+
|
1438
|
+
- (<tt>Object</tt>) <strong>teach</strong>(new_class_variable)
|
1439
|
+
|
1440
|
+
|
1441
|
+
|
1442
|
+
</p><div class="docstring">
|
1443
|
+
<div class="discussion">
|
1444
|
+
<p>
|
1445
|
+
Set the value of the class variable.
|
1446
|
+
</p>
|
1447
|
+
<p>
|
1448
|
+
This method sets the value of an attribute passed as the :class_variable
|
1449
|
+
option of the acts_as_cabalist method call to the new value and sets the
|
1450
|
+
autoclassified_at to nil so that current object is not treated as
|
1451
|
+
automatically classified.
|
1452
|
+
</p>
|
1453
|
+
|
1454
|
+
|
1455
|
+
</div>
|
1456
|
+
</div>
|
1457
|
+
<div class="tags">
|
1458
|
+
<h3>Parameters:</h3>
|
1459
|
+
<ul class="param">
|
1460
|
+
|
1461
|
+
<li>
|
1462
|
+
|
1463
|
+
<span class='name'>new_class_variable</span>
|
1464
|
+
|
1465
|
+
|
1466
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1467
|
+
|
1468
|
+
|
1469
|
+
|
1470
|
+
—
|
1471
|
+
<div class='inline'><p>
|
1472
|
+
the new value of the class variable
|
1473
|
+
</p>
|
1474
|
+
</div>
|
1475
|
+
|
1476
|
+
</li>
|
1477
|
+
|
1478
|
+
</ul>
|
1479
|
+
<h3>Returns:</h3>
|
1480
|
+
<ul class="return">
|
1481
|
+
|
1482
|
+
<li>
|
1483
|
+
|
1484
|
+
|
1485
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
1486
|
+
|
1487
|
+
|
1488
|
+
|
1489
|
+
</li>
|
1490
|
+
|
1491
|
+
</ul>
|
1492
|
+
|
1493
|
+
</div><table class="source_code">
|
1494
|
+
<tr>
|
1495
|
+
<td>
|
1496
|
+
<pre class="lines">
|
1497
|
+
|
1498
|
+
|
1499
|
+
180</pre>
|
1500
|
+
</td>
|
1501
|
+
<td>
|
1502
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 180</span>
|
1503
|
+
|
1504
|
+
<span class='kw'>def</span> <span class='id teach'>teach</span><span class='lparen'>(</span><span class='id new_class_variable'>new_class_variable</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1505
|
+
</td>
|
1506
|
+
</tr>
|
1507
|
+
</table>
|
1508
|
+
</div>
|
1509
|
+
|
1510
|
+
<div class="method_details ">
|
1511
|
+
<p class="signature " id="train_model-instance_method">
|
1512
|
+
|
1513
|
+
- (<tt>Ai4r::Classifiers::Object</tt>) <strong>train_model</strong>
|
1514
|
+
|
1515
|
+
|
1516
|
+
|
1517
|
+
</p><div class="docstring">
|
1518
|
+
<div class="discussion">
|
1519
|
+
<p>
|
1520
|
+
Build the classification model from scratch and store it in cache.
|
1521
|
+
</p>
|
1522
|
+
<p>
|
1523
|
+
This method will use a ‘build_model’ call to create a model
|
1524
|
+
from scratch but once it has been created, it will also be immediately
|
1525
|
+
stored in the cache for further retrieval using the
|
1526
|
+
‘classifier’ method.
|
1527
|
+
</p>
|
1528
|
+
|
1529
|
+
|
1530
|
+
</div>
|
1531
|
+
</div>
|
1532
|
+
<div class="tags">
|
1533
|
+
<h3>Returns:</h3>
|
1534
|
+
<ul class="return">
|
1535
|
+
|
1536
|
+
<li>
|
1537
|
+
|
1538
|
+
|
1539
|
+
<span class='type'>(<tt>Ai4r::Classifiers::Object</tt>)</span>
|
1540
|
+
|
1541
|
+
|
1542
|
+
|
1543
|
+
—
|
1544
|
+
<div class='inline'><p>
|
1545
|
+
one of classifiers from the Ai4r::Classifiers module, depending on the
|
1546
|
+
value (and presence) of the :algorithm option in the acts_as_cabalist
|
1547
|
+
method call.
|
1548
|
+
</p>
|
1549
|
+
</div>
|
1550
|
+
|
1551
|
+
</li>
|
1552
|
+
|
1553
|
+
</ul>
|
1554
|
+
|
1555
|
+
</div><table class="source_code">
|
1556
|
+
<tr>
|
1557
|
+
<td>
|
1558
|
+
<pre class="lines">
|
1559
|
+
|
1560
|
+
|
1561
|
+
132</pre>
|
1562
|
+
</td>
|
1563
|
+
<td>
|
1564
|
+
<pre class="code"><span class="info file"># File 'lib/cabalist/model_additions.rb', line 132</span>
|
1565
|
+
|
1566
|
+
<span class='kw'>def</span> <span class='id train_model'>train_model</span><span class='lparen'>(</span><span class='rparen'>)</span> <span class='kw'>end</span></pre>
|
1567
|
+
</td>
|
1568
|
+
</tr>
|
1569
|
+
</table>
|
1570
|
+
</div>
|
1571
|
+
|
1572
|
+
</div>
|
1573
|
+
|
1574
|
+
</div>
|
1575
|
+
|
1576
|
+
<div id="footer">
|
1577
|
+
Generated on Wed Apr 25 18:24:45 2012 by
|
1578
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1579
|
+
0.7.2 (ruby-1.9.2).
|
1580
|
+
</div>
|
1581
|
+
|
1582
|
+
</body>
|
1583
|
+
</html>
|