Created
October 26, 2009 22:22
-
-
Save jemmyw/219094 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'hierclust' | |
require 'benchmark' | |
points = [[815, 183], [860, 176], [793, 176], [847, 176], [813, 176], [865, 183], | |
[804, 185], [813, 181], [797, 181], [193, 133], [905, 168], [821, 173], | |
[804, 178], [799, 180], [175, 360], [880, 176], [826, 171], [843, 181], | |
[857, 171], [443, 495], [857, 174], [382, 132], [97, 1203], [218, 281], | |
[97, 1778], [814, 181], [474, 133], [797, 179], [844, 180], [812, 178], | |
[846, 18], [795, 183], [862, 182], [840, 175], [788, 176], [478, 140], | |
[860, 173], [974, 16], [833, 181], [288, 130], [831, 874], [884, 174], | |
[834, 179], [836, 182], [181, 354], [346, 46], [855, 171], [855, 180], | |
[959, 177], [792, 181], [138, 1774], [283, 783], [815, 877], [807, 178], | |
[430, 497], [819, 181], [801, 176], [836, 182], [825, 176], [873, 179], | |
[847, 182], [124, 1678], [157, 132], [835, 177], [827, 180], [532, 1191], | |
[873, 178], [174, 128], [805, 1328], [798, 178], [502, 659], [804, 180], | |
[960, 178], [886, 182], [867, 183], [875, 179], [854, 176], [849, 185], | |
[136, 1783], [800, 181], [810, 180], [312, 782], [865, 177], [745, 125], | |
[833, 178], [882, 181], [834, 177], [821, 184], [899, 182], [26, 124], | |
[859, 182], [892, 174], [172, 134], [822, 182], [396, 135], [830, 184], | |
[792, 185], [427, 488], [818, 173], [832, 177], [406, 129], [852, 181], | |
[805, 177], [820, 175], [19, 14], [839, 183], [264, 127], [800, 172], | |
[811, 176], [827, 178], [896, 177], [863, 183], [813, 177], [458, 495], | |
[808, 181], [850, 748], [810, 184], [850, 181], [886, 179], [446, 497], | |
[851, 180], [592, 132], [300, 538], [794, 180], [815, 180], [57, 1772], | |
[799, 175], [821, 182], [135, 1681], [830, 483], [796, 173], [887, 40], | |
[823, 179], [864, 179], [322, 30], [886, 182], [808, 178], [823, 189], | |
[230, 360], [224, 275], [875, 179], [133, 1773], [844, 175], [433, 495], | |
[13, 15], [856, 178], [871, 181], [658, 130], [839, 183], [822, 83], | |
[827, 175], [848, 179], [894, 184], [833, 177], [828, 176], [482, 135], | |
[841, 177], [817, 184], [470, 140], [800, 180], [857, 15], [807, 187], | |
[425, 497], [64, 131], [852, 580], [883, 183], [836, 181], [878, 177], | |
[815, 183], [860, 176], [793, 176], [847, 176], [813, 176], [865, 183], | |
[804, 185], [813, 181], [797, 181], [193, 133], [905, 168], [821, 173], | |
[804, 178], [799, 180], [175, 360], [880, 176], [826, 171], [843, 181], | |
[857, 171], [443, 495], [857, 174], [382, 132], [97, 1203], [218, 281], | |
[97, 1778], [814, 181], [474, 133], [797, 179], [844, 180], [812, 178], | |
[846, 18], [795, 183], [862, 182], [840, 175], [788, 176], [478, 140], | |
[860, 173], [974, 16], [833, 181], [288, 130], [831, 874], [884, 174], | |
[834, 179], [836, 182], [181, 354], [346, 46], [855, 171], [855, 180], | |
[959, 177], [792, 181], [138, 1774], [283, 783], [815, 877], [807, 178], | |
[430, 497], [819, 181], [801, 176], [836, 182], [825, 176], [873, 179], | |
[847, 182], [124, 1678], [157, 132], [835, 177], [827, 180], [532, 1191], | |
[873, 178], [174, 128], [805, 1328], [798, 178], [502, 659], [804, 180], | |
[960, 178], [886, 182], [867, 183], [875, 179], [854, 176], [849, 185], | |
[136, 1783], [800, 181], [810, 180], [312, 782]] | |
puts points.size | |
points = points.collect{|p| Hierclust::Point.new(p[0], p[1]) } | |
clusters = [] | |
puts Benchmark.measure { | |
clusterer = Hierclust::Clusterer.new(points, 105, 5) | |
clusters = clusterer.clusters | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'fastcluster' | |
require 'benchmark' | |
points = [[815, 183], [860, 176], [793, 176], [847, 176], [813, 176], [865, 183], | |
[804, 185], [813, 181], [797, 181], [193, 133], [905, 168], [821, 173], | |
[804, 178], [799, 180], [175, 360], [880, 176], [826, 171], [843, 181], | |
[857, 171], [443, 495], [857, 174], [382, 132], [97, 1203], [218, 281], | |
[97, 1778], [814, 181], [474, 133], [797, 179], [844, 180], [812, 178], | |
[846, 18], [795, 183], [862, 182], [840, 175], [788, 176], [478, 140], | |
[860, 173], [974, 16], [833, 181], [288, 130], [831, 874], [884, 174], | |
[834, 179], [836, 182], [181, 354], [346, 46], [855, 171], [855, 180], | |
[959, 177], [792, 181], [138, 1774], [283, 783], [815, 877], [807, 178], | |
[430, 497], [819, 181], [801, 176], [836, 182], [825, 176], [873, 179], | |
[847, 182], [124, 1678], [157, 132], [835, 177], [827, 180], [532, 1191], | |
[873, 178], [174, 128], [805, 1328], [798, 178], [502, 659], [804, 180], | |
[960, 178], [886, 182], [867, 183], [875, 179], [854, 176], [849, 185], | |
[136, 1783], [800, 181], [810, 180], [312, 782], [865, 177], [745, 125], | |
[833, 178], [882, 181], [834, 177], [821, 184], [899, 182], [26, 124], | |
[859, 182], [892, 174], [172, 134], [822, 182], [396, 135], [830, 184], | |
[792, 185], [427, 488], [818, 173], [832, 177], [406, 129], [852, 181], | |
[805, 177], [820, 175], [19, 14], [839, 183], [264, 127], [800, 172], | |
[811, 176], [827, 178], [896, 177], [863, 183], [813, 177], [458, 495], | |
[808, 181], [850, 748], [810, 184], [850, 181], [886, 179], [446, 497], | |
[851, 180], [592, 132], [300, 538], [794, 180], [815, 180], [57, 1772], | |
[799, 175], [821, 182], [135, 1681], [830, 483], [796, 173], [887, 40], | |
[823, 179], [864, 179], [322, 30], [886, 182], [808, 178], [823, 189], | |
[230, 360], [224, 275], [875, 179], [133, 1773], [844, 175], [433, 495], | |
[13, 15], [856, 178], [871, 181], [658, 130], [839, 183], [822, 83], | |
[827, 175], [848, 179], [894, 184], [833, 177], [828, 176], [482, 135], | |
[841, 177], [817, 184], [470, 140], [800, 180], [857, 15], [807, 187], | |
[425, 497], [64, 131], [852, 580], [883, 183], [836, 181], [878, 177], | |
[815, 183], [860, 176], [793, 176], [847, 176], [813, 176], [865, 183], | |
[804, 185], [813, 181], [797, 181], [193, 133], [905, 168], [821, 173], | |
[804, 178], [799, 180], [175, 360], [880, 176], [826, 171], [843, 181], | |
[857, 171], [443, 495], [857, 174], [382, 132], [97, 1203], [218, 281], | |
[97, 1778], [814, 181], [474, 133], [797, 179], [844, 180], [812, 178], | |
[846, 18], [795, 183], [862, 182], [840, 175], [788, 176], [478, 140], | |
[860, 173], [974, 16], [833, 181], [288, 130], [831, 874], [884, 174], | |
[834, 179], [836, 182], [181, 354], [346, 46], [855, 171], [855, 180], | |
[959, 177], [792, 181], [138, 1774], [283, 783], [815, 877], [807, 178], | |
[430, 497], [819, 181], [801, 176], [836, 182], [825, 176], [873, 179], | |
[847, 182], [124, 1678], [157, 132], [835, 177], [827, 180], [532, 1191], | |
[873, 178], [174, 128], [805, 1328], [798, 178], [502, 659], [804, 180], | |
[960, 178], [886, 182], [867, 183], [875, 179], [854, 176], [849, 185], | |
[136, 1783], [800, 181], [810, 180], [312, 782]] | |
puts Benchmark.measure { | |
clusterer = Fastcluster::Clusterer.new(105, 5, points) | |
clusters = clusterer.clusters | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment