Path: utzoo!attcan!uunet!bu.edu!bucasb!pet111 From: pet111@park.bu.edu (Frank Petrucci) Newsgroups: comp.ai Subject: Clustering code Message-ID: Date: 27 Feb 91 18:50:25 GMT Sender: news@bu.edu.bu.edu Distribution: comp Organization: Boston University Center for Adaptive Systems Lines: 17 John A. Hartigan has a book called Clustering Algorithms (1975), New York: Wiley, that has a k-means description(ch.4) and a program that seems to be written in BASIC. Algorithm: 1. take an initial partition, of M inputs into K clusters. (the # of clusters known in advance) 2 Take the 1st input, see whether the error would be decreased by moving the input to another cluster. If so, move to the best such cluster, and adjust calculations of the means and the error. 3 repeat step 2 for each input. 4. Go back to 2, repeat until steps 2-3 yield no changes. ------ The cluster center is based upon an average of all its members. error is based on the input's distance from the cluster center.