kmeans 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -2
- data/VERSION +1 -1
- data/doc/ChangeLog +5 -0
- data/kmeans.gemspec +2 -5
- data/lib/kmeans.rb +1 -1
- data/lib/kmeans/cluster.rb +2 -2
- data/lib/kmeans/pearson.rb +1 -1
- data/spec/lib/kmeans_spec.rb +1 -1
- metadata +2 -18
data/Gemfile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/doc/ChangeLog
CHANGED
data/kmeans.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "kmeans"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["id774"]
|
12
|
-
s.date = "2012-10-
|
12
|
+
s.date = "2012-10-30"
|
13
13
|
s.description = "K-means clustering"
|
14
14
|
s.email = "idnanashi@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -54,18 +54,15 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.specification_version = 3
|
55
55
|
|
56
56
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
-
s.add_runtime_dependency(%q<rmagick>, [">= 0"])
|
58
57
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
59
58
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
60
59
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
61
60
|
else
|
62
|
-
s.add_dependency(%q<rmagick>, [">= 0"])
|
63
61
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
64
62
|
s.add_dependency(%q<bundler>, [">= 0"])
|
65
63
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
66
64
|
end
|
67
65
|
else
|
68
|
-
s.add_dependency(%q<rmagick>, [">= 0"])
|
69
66
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
70
67
|
s.add_dependency(%q<bundler>, [">= 0"])
|
71
68
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
data/lib/kmeans.rb
CHANGED
data/lib/kmeans/cluster.rb
CHANGED
@@ -81,14 +81,14 @@ module Kmeans
|
|
81
81
|
}
|
82
82
|
1 - Pearson.calc(web_counts, centroid_counts)
|
83
83
|
}
|
84
|
-
correlations.rindex(correlations.min {
|
84
|
+
correlations.rindex(correlations.min {|x, y| x.abs <=> y.abs })
|
85
85
|
end
|
86
86
|
|
87
87
|
def average_attached(centroid)
|
88
88
|
average_word_counts = @cluster[centroid].map {|url|
|
89
89
|
@centroids[centroid].keys.map {|word| @word_counts[url][word]}
|
90
90
|
}.transpose.map {|all_counts|
|
91
|
-
all_counts.inject(0) {
|
91
|
+
all_counts.inject(0) {|sum, count|sum + count}.quo(all_counts.size)
|
92
92
|
}
|
93
93
|
Hash[*@centroids[centroid].keys.zip(average_word_counts).flatten]
|
94
94
|
end
|
data/lib/kmeans/pearson.rb
CHANGED
data/spec/lib/kmeans_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kmeans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rmagick
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
14
|
- !ruby/object:Gem::Dependency
|
31
15
|
name: cucumber
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|