Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby Shell
Tag: v0.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
doc
lib
script
spec
vendor
.gitignore
Gemfile
README.md
Rakefile
VERSION
demo.rb
kmeans.gemspec

README.md

Kmeans Cluster

K-means clustering

What is K-means?

See also.

Tutorial

require 'kmeans/pair'
require 'kmeans/pearson'
require 'kmeans/cluster'

uniform_hash = {
"test01"=> {"hoge"=>0, "fuga"=>1, "piyo"=>0 },
"test02"=> {"hoge"=>2, "fuga"=>1, "piyo"=>3 },
"test03"=> {"hoge"=>3, "fuga"=>0, "piyo"=>1 },
"test04"=> {"hoge"=>0, "fuga"=>2, "piyo"=>0 },
"test05"=> {"hoge"=>4, "fuga"=>2, "piyo"=>3 },
"test06"=> {"hoge"=>3, "fuga"=>1, "piyo"=>1 }}

result = Kmeans::Cluster.new(uniform_hash, {
  :centroids => 5,
  :loop_max => 10
})
result.make_cluster

# The results differ for each run
p result.cluster.values #=> [["test01", "test04"], ["test02"], ["test03", "test05"], ["test06"], []]

For more info, see spec files.

ChangeLog

See doc/ChangeLog.

Developers

See doc/AUTHORS.

Author

774

Copyright and license

See the file doc/LICENSE.

Something went wrong with that request. Please try again.