data_mining 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/data_mining/page_rank.rb +7 -1
  3. metadata +23 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28e3a1a81909e9619dff89714def02389e68c9da
4
- data.tar.gz: 2a2260b0fcc65003fdb037b1f859941c8100710d
3
+ metadata.gz: 8bd3fddec5ee391005c68d0b98688a15ad0049c6
4
+ data.tar.gz: f0dc879bab93ae64bbf42bb139ca5feb2bab0588
5
5
  SHA512:
6
- metadata.gz: 851076c8ca90e25ff3dcec0d6e02d513e8779dbbad190c386b7252ddc227c9b05bc822b4c5422d5cff7e27681d59b4086ff2ffcae08030327e9ed07d3fdd97a1
7
- data.tar.gz: 83ea46cdadee44244b09265333041a239e0e5534df65ee58cd0f1833c01d2b48179df823ec6116e544d9f4a525df5608a7d86ee715d872f841f2b95d6809d8e6
6
+ metadata.gz: d77e59e8ead5dfd7f171ef7a3f47dc9749579f06896200843c7a1d382169910b8fd303f6ae37d07b24fe25515ac2a5fa2b11d734f58bc9216c5f09d7d66983d2
7
+ data.tar.gz: 27c676e73655384b28d50f4247180dfcfc0c287cf1caf873cfbd014af70e0fcce346e4ea84fc76a48756b7ea96593e14350e8578c388f8e09248b04567e4feee
@@ -17,6 +17,8 @@ module DataMining
17
17
  # { :p1 => [:p2], :p2 => [:p1,:p3], :p3 => [:p2] }
18
18
  @ranks = Hash.new(1.0 / @graph.size)
19
19
  # { :p1 => 1/3, :p2 => 1/3, ... }
20
+ @sinknodes = @graph.select { |_, v| v.empty? }.keys
21
+ # sinknodes aka dead-ends, have no outlink at all
20
22
 
21
23
  @damper = damping_factor
22
24
  @iterations = iterations
@@ -47,7 +49,11 @@ module DataMining
47
49
  end
48
50
 
49
51
  def term
50
- @term ||= ((1 - @damper) / @graph.size)
52
+ ((1 - @damper + @damper * pagerank_of_sinknodes) / @graph.size)
53
+ end
54
+
55
+ def pagerank_of_sinknodes
56
+ @ranks.select { |k, _| @sinknodes.include?(k) }.values.inject(:+).to_f
51
57
  end
52
58
  end
53
59
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_mining
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Stuefer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-23 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: minitest
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
- - - ~>
17
+ - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  version: '5.7'
19
- name: minitest
20
- prerelease: false
21
20
  type: :development
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.7'
27
27
  - !ruby/object:Gem::Dependency
28
+ name: minitest-reporters
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ~>
31
+ - - "~>"
31
32
  - !ruby/object:Gem::Version
32
33
  version: '1.0'
33
- name: minitest-reporters
34
- prerelease: false
35
34
  type: :development
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
+ name: simplecov
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
- - - ~>
45
+ - - "~>"
45
46
  - !ruby/object:Gem::Version
46
47
  version: '0.10'
47
- name: simplecov
48
- prerelease: false
49
48
  type: :development
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.10'
55
55
  description: A collection of data mining algorithms
@@ -59,32 +59,32 @@ extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
61
  - lib/data_mining.rb
62
- - lib/data_mining/dbscan.rb
63
- - lib/data_mining/point.rb
64
62
  - lib/data_mining/apriori.rb
63
+ - lib/data_mining/dbscan.rb
65
64
  - lib/data_mining/page_rank.rb
65
+ - lib/data_mining/point.rb
66
66
  homepage: https://github.com/mstuefer/data_mining
67
67
  licenses:
68
68
  - MIT
69
69
  metadata: {}
70
- post_install_message:
70
+ post_install_message:
71
71
  rdoc_options: []
72
72
  require_paths:
73
73
  - lib
74
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - '>='
76
+ - - ">="
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.1.9
87
- signing_key:
85
+ rubyforge_project:
86
+ rubygems_version: 2.4.6
87
+ signing_key:
88
88
  specification_version: 4
89
89
  summary: Data-Mining-Algorithms
90
90
  test_files: []