kmeans 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -1
- data/VERSION +1 -1
- data/demo.rb +23 -0
- data/doc/ChangeLog +5 -0
- data/kmeans.gemspec +3 -2
- data/lib/kmeans.rb +1 -1
- data/spec/lib/kmeans_spec.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -15,7 +15,30 @@ See also.
|
|
15
15
|
Tutorial
|
16
16
|
--------
|
17
17
|
|
18
|
-
|
18
|
+
``` html
|
19
|
+
require 'kmeans/pair'
|
20
|
+
require 'kmeans/pearson'
|
21
|
+
require 'kmeans/cluster'
|
22
|
+
|
23
|
+
uniform_hash = {
|
24
|
+
"test01"=> {"hoge"=>0, "fuga"=>1, "piyo"=>0 },
|
25
|
+
"test02"=> {"hoge"=>2, "fuga"=>1, "piyo"=>3 },
|
26
|
+
"test03"=> {"hoge"=>3, "fuga"=>0, "piyo"=>1 },
|
27
|
+
"test04"=> {"hoge"=>0, "fuga"=>2, "piyo"=>0 },
|
28
|
+
"test05"=> {"hoge"=>4, "fuga"=>2, "piyo"=>3 },
|
29
|
+
"test06"=> {"hoge"=>3, "fuga"=>1, "piyo"=>1 }}
|
30
|
+
|
31
|
+
result = Kmeans::Cluster.new(uniform_hash, {
|
32
|
+
:centroids => 5,
|
33
|
+
:loop_max => 10
|
34
|
+
})
|
35
|
+
result.make_cluster
|
36
|
+
|
37
|
+
# The results differ for each run
|
38
|
+
p result.cluster.values #=> [["test01", "test04"], ["test02"], ["test03", "test05"], ["test06"], []]
|
39
|
+
```
|
40
|
+
|
41
|
+
For more info, see spec files.
|
19
42
|
|
20
43
|
|
21
44
|
ChangeLog
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/demo.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
require 'kmeans/pair'
|
5
|
+
require 'kmeans/pearson'
|
6
|
+
require 'kmeans/cluster'
|
7
|
+
|
8
|
+
uniform_hash = {
|
9
|
+
"test01"=> {"hoge"=>0, "fuga"=>1, "piyo"=>0 },
|
10
|
+
"test02"=> {"hoge"=>2, "fuga"=>1, "piyo"=>3 },
|
11
|
+
"test03"=> {"hoge"=>3, "fuga"=>0, "piyo"=>1 },
|
12
|
+
"test04"=> {"hoge"=>0, "fuga"=>2, "piyo"=>0 },
|
13
|
+
"test05"=> {"hoge"=>4, "fuga"=>2, "piyo"=>3 },
|
14
|
+
"test06"=> {"hoge"=>3, "fuga"=>1, "piyo"=>1 }}
|
15
|
+
|
16
|
+
result = Kmeans::Cluster.new(uniform_hash, {
|
17
|
+
:centroids => 5,
|
18
|
+
:loop_max => 10
|
19
|
+
})
|
20
|
+
result.make_cluster
|
21
|
+
|
22
|
+
# The results differ for each run
|
23
|
+
p result.cluster.values #=> [["test01", "test04"], ["test02"], ["test03", "test05"], ["test06"], []]
|
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.1.0"
|
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 = "2013-07-
|
12
|
+
s.date = "2013-07-09"
|
13
13
|
s.description = "K-means clustering"
|
14
14
|
s.email = "idnanashi@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
"README.md",
|
21
21
|
"Rakefile",
|
22
22
|
"VERSION",
|
23
|
+
"demo.rb",
|
23
24
|
"doc/AUTHORS",
|
24
25
|
"doc/COPYING",
|
25
26
|
"doc/COPYING.LESSER",
|
data/lib/kmeans.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.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- README.md
|
71
71
|
- Rakefile
|
72
72
|
- VERSION
|
73
|
+
- demo.rb
|
73
74
|
- doc/AUTHORS
|
74
75
|
- doc/COPYING
|
75
76
|
- doc/COPYING.LESSER
|