Skip to content
No description or website provided.
C Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ext
lib
spec
.gitignore
CHANGELOG
Gemfile
Gemfile.lock
Manifest
README.rdoc
Rakefile
fastcluster.gemspec
test.rb

README.rdoc

Simple and fast clustering library

DESCRIPTION

This gem provides a really simple way to cluster 2 dimensional points. It is based on the Hierclust gem by Brandt Kurowski, except that it does not cluster hierarchically. The aim of this gem is to provide the same clustering algorithm but to be as fast as possible.

INSTALL:

  • sudo gem install fastcluster

EXAMPLE:

require 'fastcluster'
points = [[1, 1], [1, 2], [5, 9]]
clusterer = Fastcluster::Clusterer.new(3, 0, points)
clusterer.clusters.each do |cluster|
  puts cluster.x
  puts cluster.y
  puts cluster.size
end

ALGORITHM:

  1. All points are initially clusters with size 1

  2. Precluster - create a grid of size [resolution] and cluster the points in each grid space automatically

  3. Combine two closest clusters, the new cluster has the summed size and the averaged distance (size weighted) between the clusters.

  4. Loop to 3 until no cluster is less that [separation] apart or only one cluster remains

LICENSE:

(The MIT License)

Copyright © 2009 Jeremy Wells

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.