apriori 0.2.1 → 0.2.2
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/History.txt +3 -0
- data/README.txt +7 -7
- data/examples/01_simple_example.rb +8 -8
- data/lib/apriori/association_rule.rb +8 -0
- data/lib/apriori/version.rb +1 -1
- data/website/index.html +17 -14
- data/website/index.txt +14 -12
- metadata +1 -1
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -68,15 +68,15 @@ This document is not an introduction to the Apriori algorithm. To find out more
|
|
68
68
|
puts rules.join("\n")
|
69
69
|
|
70
70
|
# Results:
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
71
|
+
# beer -> doritos (33.3/2, 100.0)
|
72
|
+
# doritos -> beer (50.0/3, 66.7)
|
73
|
+
# doritos -> apple (50.0/3, 33.3)
|
74
|
+
# apple -> doritos (66.7/4, 25.0)
|
75
|
+
# cheese -> apple (50.0/3, 100.0)
|
76
|
+
# apple -> cheese (66.7/4, 75.0)
|
77
77
|
|
78
78
|
# NOTE:
|
79
|
-
#
|
79
|
+
# beer -> doritos (33.3/2, 100.0)
|
80
80
|
# means:
|
81
81
|
# * beer appears in 33.3% (2 total) of the transactions (the support)
|
82
82
|
# * beer implies doritos 100% of the time (the confidence)
|
@@ -17,16 +17,16 @@ rules = Apriori.find_association_rules(transactions,
|
|
17
17
|
|
18
18
|
puts rules.join("\n")
|
19
19
|
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
20
|
+
# Results:
|
21
|
+
# beer -> doritos (33.3/2, 100.0)
|
22
|
+
# doritos -> beer (50.0/3, 66.7)
|
23
|
+
# doritos -> apple (50.0/3, 33.3)
|
24
|
+
# apple -> doritos (66.7/4, 25.0)
|
25
|
+
# cheese -> apple (50.0/3, 100.0)
|
26
|
+
# apple -> cheese (66.7/4, 75.0)
|
27
27
|
|
28
28
|
# NOTE:
|
29
|
-
#
|
29
|
+
# beer -> doritos (33.3/2, 100.0)
|
30
30
|
# means:
|
31
31
|
# * beer appears in 33.3% (2 total) of the transactions (the support)
|
32
32
|
# * beer implies doritos 100% of the time (the confidence)
|
@@ -41,6 +41,10 @@ module Apriori
|
|
41
41
|
# Given +line+ returns an Itemset
|
42
42
|
# Example of a line:
|
43
43
|
# foo <- bar baz bangle (66.7/4, 75.0)
|
44
|
+
#
|
45
|
+
# Note that this is the opposite order of how apriori.rb returns the
|
46
|
+
# AssociationRule#to_s. (apriori.rb returns the antecedent on the left
|
47
|
+
# and consequent on the right)
|
44
48
|
def parse_line(line)
|
45
49
|
is = new
|
46
50
|
line =~ /(.+)\s+<-\s+(.+?)\s+\((\d+\.\d)(?:\/(\d+))?,\s+(\d+\.\d)\)/
|
@@ -56,6 +60,10 @@ module Apriori
|
|
56
60
|
|
57
61
|
# Returns the standard form of this rule as a string. For instance:
|
58
62
|
# bar baz bangle -> foo (66.7/4, 75.0)
|
63
|
+
# # (antecedent) (consequent)
|
64
|
+
#
|
65
|
+
# Note that this order is the opposite order of the association rules returned by apriori.c
|
66
|
+
# I believe this format reads more naturally.
|
59
67
|
def to_s
|
60
68
|
# "%s <- %s (%0.01f%s, %0.01f)" % [ consequent,
|
61
69
|
# antecedent.join(" "),
|
data/lib/apriori/version.rb
CHANGED
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>apriori</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/apriori"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/apriori" class="numbers">0.2.
|
36
|
+
<a href="http://rubyforge.org/projects/apriori" class="numbers">0.2.2</a>
|
37
37
|
<img src="images/2118201782_4e87521dc9_m.jpg" />
|
38
38
|
</div>
|
39
39
|
<h1>→ ‘find item associations’</h1>
|
@@ -47,7 +47,7 @@ large sets of transactions. This library provides a Ruby interface to Christian
|
|
47
47
|
Borgelt’s C implementation of this algorithm.</p>
|
48
48
|
|
49
49
|
|
50
|
-
<p>From
|
50
|
+
<p>From <a href="http://www.borgelt.net/apriori.html">Christian Borgelt’s Apriori</a> documentation:</p>
|
51
51
|
|
52
52
|
|
53
53
|
<blockquote>
|
@@ -129,15 +129,15 @@ Borgelt’s C implementation of this algorithm.</p>
|
|
129
129
|
<span class="ident">puts</span> <span class="ident">rules</span><span class="punct">.</span><span class="ident">join</span><span class="punct">("</span><span class="string"><span class="escape">\n</span></span><span class="punct">")</span>
|
130
130
|
|
131
131
|
<span class="comment"># Results: </span>
|
132
|
-
<span class="comment">#
|
133
|
-
<span class="comment">#
|
134
|
-
<span class="comment">#
|
135
|
-
<span class="comment">#
|
136
|
-
<span class="comment">#
|
137
|
-
<span class="comment">#
|
132
|
+
<span class="comment"># beer -> doritos (33.3/2, 100.0)</span>
|
133
|
+
<span class="comment"># doritos -> beer (50.0/3, 66.7)</span>
|
134
|
+
<span class="comment"># doritos -> apple (50.0/3, 33.3)</span>
|
135
|
+
<span class="comment"># apple -> doritos (66.7/4, 25.0)</span>
|
136
|
+
<span class="comment"># cheese -> apple (50.0/3, 100.0)</span>
|
137
|
+
<span class="comment"># apple -> cheese (66.7/4, 75.0)</span>
|
138
138
|
|
139
139
|
<span class="comment"># NOTE:</span>
|
140
|
-
<span class="comment">#
|
140
|
+
<span class="comment"># beer -> doritos (33.3/2, 100.0)</span>
|
141
141
|
<span class="comment"># means: </span>
|
142
142
|
<span class="comment"># * beer appears in 33.3% (2 total) of the transactions (the support)</span>
|
143
143
|
<span class="comment"># * beer implies doritos 100% of the time (the confidence)</span>
|
@@ -147,13 +147,16 @@ Borgelt’s C implementation of this algorithm.</p>
|
|
147
147
|
<p>See the <ins>examples</ins> directory for more examples of usage.</p>
|
148
148
|
|
149
149
|
|
150
|
-
<h2>
|
150
|
+
<h2>Rdoc</h2>
|
151
151
|
|
152
152
|
|
153
|
-
<p><a href="http://
|
153
|
+
<p><a href="http://apriori.rubyforge.org/rdoc/">View the rdoc here</a></p>
|
154
154
|
|
155
155
|
|
156
|
-
<
|
156
|
+
<h2>Mailing List</h2>
|
157
|
+
|
158
|
+
|
159
|
+
<p><a href="http://rubyforge.org/mail/?group_id=6948">Rubyforge Mailing List</a></p>
|
157
160
|
|
158
161
|
|
159
162
|
<h2>How to submit patches</h2>
|
@@ -173,7 +176,7 @@ Borgelt’s C implementation of this algorithm.</p>
|
|
173
176
|
rake test
|
174
177
|
rake install_gem</pre>
|
175
178
|
|
176
|
-
<
|
179
|
+
<h3><tt>add_development_dependency</tt> error</h3>
|
177
180
|
|
178
181
|
|
179
182
|
<p>If you get the error:</p>
|
@@ -237,7 +240,7 @@ included in all copies or substantial portions of the Software.</p>
|
|
237
240
|
|
238
241
|
<p>Comments are welcome. Send an email to <a href="mailto:nate@natemurray.com">Nate Murray</a> via the <a href="http://groups.google.com/group/apriori">forum</a></p>
|
239
242
|
<p class="coda">
|
240
|
-
<a href="nate@natemurray.com">Nate Murray</a>,
|
243
|
+
<a href="nate@natemurray.com">Nate Murray</a>, 18th September 2008<br>
|
241
244
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
242
245
|
</p>
|
243
246
|
</div>
|
data/website/index.txt
CHANGED
@@ -9,7 +9,7 @@ Ruby Apriori is a library to efficiently find item association rules within
|
|
9
9
|
large sets of transactions. This library provides a Ruby interface to Christian
|
10
10
|
Borgelt's C implementation of this algorithm.
|
11
11
|
|
12
|
-
From Christian Borgelt's Apriori:http://www.borgelt.net/apriori.html documentation:
|
12
|
+
From "Christian Borgelt's Apriori":http://www.borgelt.net/apriori.html documentation:
|
13
13
|
|
14
14
|
bq. Association rule induction is a powerful method for so-called market basket
|
15
15
|
analysis, which aims at finding regularities in the shopping behavior of
|
@@ -68,15 +68,15 @@ h2. Demonstration of usage
|
|
68
68
|
puts rules.join("\n")
|
69
69
|
|
70
70
|
# Results:
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
71
|
+
# beer -> doritos (33.3/2, 100.0)
|
72
|
+
# doritos -> beer (50.0/3, 66.7)
|
73
|
+
# doritos -> apple (50.0/3, 33.3)
|
74
|
+
# apple -> doritos (66.7/4, 25.0)
|
75
|
+
# cheese -> apple (50.0/3, 100.0)
|
76
|
+
# apple -> cheese (66.7/4, 75.0)
|
77
77
|
|
78
78
|
# NOTE:
|
79
|
-
#
|
79
|
+
# beer -> doritos (33.3/2, 100.0)
|
80
80
|
# means:
|
81
81
|
# * beer appears in 33.3% (2 total) of the transactions (the support)
|
82
82
|
# * beer implies doritos 100% of the time (the confidence)
|
@@ -84,11 +84,13 @@ h2. Demonstration of usage
|
|
84
84
|
|
85
85
|
See the +examples+ directory for more examples of usage.
|
86
86
|
|
87
|
-
h2.
|
87
|
+
h2. Rdoc
|
88
88
|
|
89
|
-
"
|
89
|
+
"View the rdoc here":http://apriori.rubyforge.org/rdoc/
|
90
90
|
|
91
|
-
|
91
|
+
h2. Mailing List
|
92
|
+
|
93
|
+
"Rubyforge Mailing List":http://rubyforge.org/mail/?group_id=6948
|
92
94
|
|
93
95
|
h2. How to submit patches
|
94
96
|
|
@@ -102,7 +104,7 @@ h3. Build and test instructions
|
|
102
104
|
rake test
|
103
105
|
rake install_gem</pre>
|
104
106
|
|
105
|
-
h3.
|
107
|
+
h3. <tt>add_development_dependency</tt> error
|
106
108
|
|
107
109
|
If you get the error:
|
108
110
|
|