Lecture 5 clustering

Lecture 5 - Clustering

The curse of dimensionality - in large dimensional spaces, almost all points are far away from each other, and almost any two vectors are almost orthogonal.

BFR Algorithm

K means for data that doesn’t fit in memory Assumes that clusters are normally distributed around a centroid in Euclidean space. Standard deviations in different dimensions may vary. Clusters are axis-aligned ellipses.

Goal is to find cluster centroids, point assignment done in second pass Want memory required O(clusters) not O(data) Idea: rather than keeping data points, BFR keeps summary statistics of groups of points

Generates clusters dynamically as we discover more data.

BFR Algo

  1. Initalize K clusters/ centroids
  2. Load in a bag points from disk
  3. Assign new points to one of the K original clusters, if they are within some distance threshold of the cluster (see ‘Details’ below)
    • incorporate those points to the cluster’s summary statistics and then add them to the discard set
  4. Cluster the remaining points, and create new clusters
    • Use any in-memory clustering algorithm to cluster the remaining points and the old retained set (RS). Clusters go to Compression Set (CS), outlying points go to RS.
  5. Try to merge new clusters from step 4 with any of the existing clusters
    • Adjust the statistics of the clusters to account for the new points.
      • Add the count to n, add vector sum to the SUM, add sum of squares to SUMSQ
    • Also consider merging compressed sets in the compression set at this stage.
  6. Repeat steps 2-5 until all points are eliminated.
    • If this is the last round, merge all compressed sets in teh CS and all RS points to their nearest cluster.

Points are read from disk one main-memory-full-batch at a time Most points from previous memory loads are summarised by sample statistics Step 1) From the initial load we select the initial k centroids by some sensible approach

Possible Initializaitons

3 sets of summary statistics we keep track of (1)

For each cluster, the discard set is summarised by the 2d+1 points (n, SUM, SUMSQ), where d is the number of dimensions and

Then, the average in each dimension (the centroid) is SUM/n and variance of a clusters discard set in dimension i is : (SUMSQ_i / n) - (SUM_i /n)^2. The cluster is defined with these two statistics.

Details:

Distance thresholds:

(1) There is a distance threshold that is used to assign points to one of the k original clusters. Compression set- not attached to the cluster Retained set - leftover points

CURE Algorithm (Clustering Using Representatives)

Motivations: Problem with BFR/k-means: Assumes clusters are normally distributed in each dimension, and axes are fixed - ellipses at an angle are NOT ok. CURE

CURE Algorithm: 2 Passes: Pass 1: Getting Representative Points

  1. Pick a random sample of points that fit into main memory.
  2. Initial Clusters by in-memory hierarchical clustering (group nearest points/clusters.)
  3. Pick representative points:
    • For each cluster, pick a sample of points as dispersed as possible.
    • From the sample, pick representatives by moving the points farthest away from each other (say) 20% towards the centroid of the cluster. The moved points are the representatives.

Pass 2: Assigning Points

  1. Rescan the whole dataset and place each point p in the “closest cluster”
    • Closest is the closest representative point to p, p gets assigned to the representative’s cluster.

Intuition: A large, dispersed cluster will have large moves from its boundary, while a small dense cluster will have little move. So this also favours a small dense cluster over a nearby large dispersed cluster.