public
Description: A ruby/c extension to Christian Borgelt's apriori item-set implementation
Homepage:
Clone URL: git://github.com/jashmenn/apriori.git
jashmenn (author)
Thu Sep 18 10:12:34 -0700 2008
commit  13226550994f414f81380af5c5c0e8438f45a5d4
tree    6782b3c8c77b93a12f19849f3cb48c8e803fca00
parent  7da4bfbced40b53a7cdee4def12f041b4673cdea
name age message
file .gitignore Thu Sep 04 19:00:24 -0700 2008 updated to include gem dependencies [jashmenn]
file .session Wed Aug 13 08:47:54 -0700 2008 got first draft of everything compiling nicely [jashmenn]
directory .sessions/ Sat Aug 30 10:48:45 -0700 2008 continued work on the major reorganization [jashmenn]
file History.txt Thu Sep 18 09:15:53 -0700 2008 v0.2.2 - updated docs, cleaning rough edges for... [jashmenn]
file License.txt Sat Aug 30 11:17:45 -0700 2008 moved the newgem material into the overall picture [jashmenn]
file Manifest.txt Thu Sep 04 09:40:08 -0700 2008 have it so gem will install and compile [jashmenn]
file PostInstall.txt Wed Sep 17 13:48:51 -0700 2008 0.2.1 - updated requirements to check for the p... [jashmenn]
file README.txt Thu Sep 18 09:15:53 -0700 2008 v0.2.2 - updated docs, cleaning rough edges for... [jashmenn]
file Rakefile Fri Sep 05 08:03:51 -0700 2008 updated rakefile to work properly w/ default task [nathan]
file TODO.txt Thu Sep 04 08:43:33 -0700 2008 working on website [jashmenn]
file apriori.gemspec Thu Sep 18 09:17:06 -0700 2008 updated github gemspec [jashmenn]
directory attic/ Sat Aug 30 10:48:45 -0700 2008 continued work on the major reorganization [jashmenn]
directory config/ Wed Sep 17 13:48:51 -0700 2008 0.2.1 - updated requirements to check for the p... [jashmenn]
directory examples/ Thu Sep 18 10:12:34 -0700 2008 updated the presentation [jashmenn]
directory ext/ Fri Sep 05 08:03:51 -0700 2008 updated rakefile to work properly w/ default task [nathan]
directory lib/ Thu Sep 18 09:15:53 -0700 2008 v0.2.2 - updated docs, cleaning rough edges for... [jashmenn]
directory script/ Sat Aug 30 11:17:45 -0700 2008 moved the newgem material into the overall picture [jashmenn]
file setup.rb Sat Aug 30 11:17:45 -0700 2008 moved the newgem material into the overall picture [jashmenn]
directory tasks/ Thu Sep 04 19:00:24 -0700 2008 updated to include gem dependencies [jashmenn]
directory test/ Tue Sep 02 18:41:14 -0700 2008 changed find_itemsets -> find_association_rules... [jashmenn]
directory website/ Thu Sep 18 09:17:06 -0700 2008 updated github gemspec [jashmenn]
directory xdoc/ Thu Sep 18 10:12:34 -0700 2008 updated the presentation [jashmenn]
README.txt
= apriori

* This project can be found at: http://github.com/jashmenn/apriori/tree/master
* Christian Borgelt's original C code can be found at: http://www.borgelt.net/apriori.html

== DESCRIPTION:

Ruby Apriori is a library to efficiently find item association rules within
large sets of transactions. This library provides a Ruby interface to Christian
Borgelt's C implementation of this algorithm.

From Christian Borgelt's Apriori:http://www.borgelt.net/apriori.html documentation: 

  Association rule induction is a powerful method for so-called market basket
  analysis, which aims at finding regularities in the shopping behavior of
  customers.

  With the induction of association rules one tries to find sets of
  products that are frequently bought together, so that from the presence of
  certain products in a shopping cart one can infer (with a high probability)
  that certain other products are present. 

  An association rule is a rule like "If a customer buys wine and bread, he often
  buys cheese, too."

  An association rule states that if we pick a customer at random and find out
  that he selected certain items (bought certain products, chose certain options
  etc.), we can be confident, quantified by a percentage, that he also selected
  certain other items (bought certain other products, chose certain other options
  etc.).

This Ruby library provides a convenient way to use this algorithm from Ruby.

Original Apriori C code by Christian Borgelt. 

== THE ALGORITHM:

This document is not an introduction to the Apriori algorithm. To find out more about Apriori see:

* http://www.borgelt.net/papers/cstat_02.pdf
* http://www.borgelt.net/papers/fimi_03.pdf
* http://www.borgelt.net/apriori.html
* http://en.wikipedia.org/wiki/Apriori_algorithm

== FEATURES:

* Supports easy use from Ruby data types
* Supports large data files

== EXAMPLE USAGE:

  require 'apriori'

  transactions = [  %w{beer doritos},
                    %w{apple cheese}, 
                    %w{beer doritos}, 
                    %w{apple cheese}, 
                    %w{apple cheese}, 
                    %w{apple doritos} ]

  rules = Apriori.find_association_rules(transactions,
                            :min_items => 2,
                            :max_items => 5,
                            :min_support => 1, 
                            :max_support => 100, 
                            :min_confidence => 20)

  puts rules.join("\n")

  # Results: 
  # beer -> doritos (33.3/2, 100.0)
  # doritos -> beer (50.0/3, 66.7)
  # doritos -> apple (50.0/3, 33.3)
  # apple -> doritos (66.7/4, 25.0)
  # cheese -> apple (50.0/3, 100.0)
  # apple -> cheese (66.7/4, 75.0)

  # NOTE:
  # beer -> doritos (33.3/2, 100.0)
  # means: 
  # * beer appears in 33.3% (2 total) of the transactions (the support)
  # * beer implies doritos 100% of the time (the confidence)

See the +examples+ directory for more examples of usage.

== EXAMPLE DATA:

Example data can be found at:

http://fimi.cs.helsinki.fi/data/

== REQUIREMENTS:

This library is compiled using a slightly modified version of Christian
Borgelt's original C implementation of Apriori. The original code can be found
at: http://www.borgelt.net/apriori.html

* +gcc+ or similar compiler
* <tt>ruby.h</tt>

== INSTALL:

* gem install --source http://gems.github.com jashmenn-apriori

== FAQ:

If you get the error:

  undefined method `add_development_dependency' for #<Gem::Specification:0x2aabcba63ed8>

This is because hoe 1.7.0 requires rubygems 1.2.0. To upgrade, simply do the following:

  gem update --system

== LICENSE:

=== Apriori C code

Copyright (c) Christian Borgelt

Modified and under the LGPL license. 
See ext/apriori/doc/copying for details.

=== Ruby Apriori Extension

(The MIT License)

Copyright (c) 2008 Nate Murray

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

=========================================================================