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 CHANGED
@@ -15,7 +15,30 @@ See also.
15
15
  Tutorial
16
16
  --------
17
17
 
18
- See spec files.
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.9
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"], []]
@@ -1,3 +1,8 @@
1
+ === 0.1.0 / 2013-07-09
2
+
3
+ * Append tutorial, demo script.
4
+
5
+
1
6
  === 0.0.9 / 2013-07-04
2
7
 
3
8
  * Fix bug of cluster nil name.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "kmeans"
8
- s.version = "0.0.9"
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-04"
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",
@@ -2,7 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
4
  module Kmeans
5
- VERSION = "0.0.9"
5
+ VERSION = "0.1.0"
6
6
  require File.dirname(__FILE__) + "/kmeans/pair"
7
7
  require File.dirname(__FILE__) + "/kmeans/pearson"
8
8
  require File.dirname(__FILE__) + "/kmeans/cluster"
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
5
5
  describe Kmeans do
6
6
  context 'のバージョンを参照した場合' do
7
7
  it "バージョンが正しく表示される" do
8
- expect = '0.0.9'
8
+ expect = '0.1.0'
9
9
  Kmeans.const_get(:VERSION).should be_true
10
10
  Kmeans.const_get(:VERSION).should == expect
11
11
  end
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.9
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-04 00:00:00.000000000 Z
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