apriori-algorithm 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +64 -0
- data/Guardfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +45 -0
- data/Rakefile +2 -0
- data/apriori-algorithm.gemspec +25 -0
- data/lib/apriori.rb +9 -0
- data/lib/apriori/algorithm.rb +137 -0
- data/lib/apriori/analysis_result.rb +12 -0
- data/lib/apriori/association_rule.rb +14 -0
- data/lib/apriori/frequent_item_set.rb +12 -0
- data/spec/dataset.csv +1421 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/usage_spec.rb +27 -0
- metadata +119 -0
data/spec/spec_helper.rb
ADDED
data/spec/usage_spec.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'apriori/algorithm'
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
RSpec.describe Apriori::Algorithm do
|
6
|
+
|
7
|
+
transactions = []
|
8
|
+
File.open('spec/dataset.csv') do |file|
|
9
|
+
file.each_line do |line|
|
10
|
+
transactions << CSV.parse(line)[0]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'works as expected with default settings' do
|
15
|
+
algorithm = Apriori::Algorithm.new()
|
16
|
+
result = algorithm.analyze(transactions)
|
17
|
+
expect(result.association_rules.length).to eq(5)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'works as expected with custom settings' do
|
21
|
+
algorithm = Apriori::Algorithm.new(0.15, 0.8)
|
22
|
+
result = algorithm.analyze(transactions)
|
23
|
+
expect(result.association_rules.length).to eq(4)
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: apriori-algorithm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kazuhiro Sera
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Apriori Algorithm implementation in Ruby
|
70
|
+
email:
|
71
|
+
- seratch@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- Gemfile.lock
|
79
|
+
- Guardfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- apriori-algorithm.gemspec
|
84
|
+
- lib/apriori.rb
|
85
|
+
- lib/apriori/algorithm.rb
|
86
|
+
- lib/apriori/analysis_result.rb
|
87
|
+
- lib/apriori/association_rule.rb
|
88
|
+
- lib/apriori/frequent_item_set.rb
|
89
|
+
- spec/dataset.csv
|
90
|
+
- spec/spec_helper.rb
|
91
|
+
- spec/usage_spec.rb
|
92
|
+
homepage: ''
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.2.0
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Apriori Algorithm implementation in Ruby
|
116
|
+
test_files:
|
117
|
+
- spec/dataset.csv
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
- spec/usage_spec.rb
|