apriori
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Another ruby apriori wrapper
# Apriori

This is another ruby wrapper gem for the apriori implementation of Christian Borgelt.
Currently, this is more a dirty hack, since the binary is included and the items may not include any commas and semicolons.
However, using this gem is really simple and straight forward if you're using an amd64 architecture and a linux box.

def calculate
  rules = []

  Apriori.rules do |apriori|
    apriori.add_transaction ["beer", "cheese"]
    apriori.add_transaction ["beer", "mr.tom"]
    apriori.add_transaction ["beer", "cheese"]

    apriori.each do |rule|
      rules.push rule
    end
  end

  rules
end

irb> calculate
=> [{:destination=>["beer"], :source=>["mr.tom"], :support=>25.0, :confidence=>100.0}, ...]
## Installation Gemfile:
gem "apriori", :git => "git://github.com/mrkamel/apriori.git"

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。