Clustering

Statistical Clustering.k-Means .*;

k-Means: Large, Random Samples

This example uses similar code as Example 1, but with 100 randomly chosen samples and more centroids.

You can change the constants to almost any value for experimentation:

  • NUM_CLUSTERS: Total clusters.
  • TOTAL_DATA: Total data points.
  • MIN_COORDINATE: Minimum coordinate value to choose at random.
  • MAX_COORDINATE: Maximum coordinate value to choose at random.

 

Example Results

NUM_CLUSTERS = 5, TOTAL_DATA = 100, MIN_COORDINATE = 0.0, MAX_COORDINATE = 500.0

Centroids initialized at:
     (95.0, 161.0)
     (127.0, 214.0)
     (44.0, 211.0)
     (278.0, 205.0)
     (193.0, 143.0)

Cluster 0 includes:
     (38.0, 70.0)
     (69.0, 43.0)
     (33.0, 83.0)
     (109.0, 149.0)
     (59.0, 106.0)
     (107.0, 121.0)
     (73.0, 152.0)
     (23.0, 19.0)
     (9.0, 4.0)
     (11.0, 93.0)
     (55.0, 48.0)
     (87.0, 88.0)
     (37.0, 8.0)
     (38.0, 29.0)
     (68.0, 110.0)

Cluster 1 includes:
     (153.0, 419.0)
     (495.0, 491.0)
     (130.0, 498.0)
     (274.0, 465.0)
     (367.0, 362.0)
     (225.0, 455.0)
     (308.0, 285.0)
     (116.0, 425.0)
     (152.0, 404.0)
     (200.0, 384.0)
     (176.0, 391.0)
     (424.0, 475.0)
     (227.0, 449.0)
     (247.0, 332.0)
     (313.0, 309.0)
     (256.0, 251.0)
     (449.0, 446.0)
     (393.0, 389.0)
     (246.0, 292.0)
     (260.0, 267.0)
     (303.0, 258.0)
     (162.0, 475.0)
     (473.0, 477.0)
     (398.0, 437.0)
     (248.0, 465.0)
     (380.0, 339.0)
     (239.0, 285.0)
     (304.0, 299.0)
     (498.0, 498.0)
     (203.0, 433.0)
     (453.0, 448.0)
     (340.0, 294.0)

Cluster 2 includes:
     (104.0, 290.0)
     (210.0, 296.0)
     (201.0, 280.0)
     (0.0, 233.0)
     (145.0, 288.0)
     (224.0, 202.0)
     (6.0, 497.0)
     (121.0, 159.0)
     (25.0, 369.0)
     (127.0, 297.0)
     (74.0, 301.0)
     (172.0, 215.0)
     (125.0, 171.0)
     (243.0, 223.0)
     (225.0, 266.0)
     (204.0, 284.0)
     (129.0, 182.0)
     (181.0, 176.0)
     (77.0, 342.0)
     (57.0, 285.0)
     (27.0, 260.0)
     (113.0, 334.0)
     (224.0, 264.0)
     (27.0, 248.0)
     (80.0, 164.0)
     (11.0, 500.0)
     (89.0, 174.0)
     (123.0, 352.0)

Cluster 3 includes:
     (331.0, 144.0)
     (483.0, 62.0)
     (389.0, 82.0)
     (427.0, 266.0)
     (459.0, 48.0)
     (405.0, 135.0)
     (494.0, 34.0)
     (401.0, 119.0)
     (361.0, 106.0)
     (435.0, 181.0)

Cluster 4 includes:
     (263.0, 17.0)
     (327.0, 31.0)
     (345.0, 59.0)
     (235.0, 48.0)
     (202.0, 50.0)
     (234.0, 24.0)
     (331.0, 52.0)
     (269.0, 74.0)
     (222.0, 74.0)
     (343.0, 71.0)
     (350.0, 69.0)
     (308.0, 171.0)
     (271.0, 135.0)
     (175.0, 134.0)
     (256.0, 155.0)

Centroids finalized at:
     (50.0, 69.0)
     (275.0, 385.0)
     (119.0, 252.0)
     (408.0, 122.0)
     (280.0, 66.0)

 

public void footer() {
About | Contact | Privacy Policy | Terms of Service | Site Map
Copyright© 2009-2012 John McCullock. All Rights Reserved.
}