LECTURE 22: CLUSTERING

12
ECE 8443 – Pattern Recognition ECE 8443 – Pattern Recognition Objectives: Mixture Densities Maximum Likelihood Estimates Application to Gaussian Mixture Models k-Means Clustering Fuzzy k-Means Clustering Resources: J.B.: EM Estimation A.M.: GMM Models D.D.: Clustering C.B.: Unsupervised Clustering Wiki: K-Means A.M.: Hierarchical Clustering MU: Introduction to Clustering Java PR Applet LECTURE 22: CLUSTERING Audio: URL:

description

LECTURE 22: CLUSTERING. Objectives: Mixture Densities Maximum Likelihood Estimates Application to Gaussian Mixture Models k-Means Clustering Fuzzy k- Means Clustering - PowerPoint PPT Presentation

Transcript of LECTURE 22: CLUSTERING

Page 1: LECTURE  22:  CLUSTERING

ECE 8443 – Pattern RecognitionECE 8443 – Pattern Recognition

• Objectives:Mixture DensitiesMaximum Likelihood EstimatesApplication to Gaussian Mixture Modelsk-Means ClusteringFuzzy k-Means Clustering

• Resources:J.B.: EM EstimationA.M.: GMM ModelsD.D.: ClusteringC.B.: Unsupervised ClusteringWiki: K-MeansA.M.: Hierarchical ClusteringMU: Introduction to ClusteringJava PR Applet

LECTURE 22: CLUSTERING

Audio:URL:

Page 2: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 2

Introduction• Training procedures that use labeled samples are referred to as supervised.

• Unsupervised procedures use unlabeled data.

• Seven basic reasons why we are interested in unsupervised methods:1) Data collection and labeling data is very costly and nontrivial (often this is

a research problem in itself).2) Heuristic methods (application-specific) exist that allow us to improve a

classifier trained using supervised techniques by introducing large amounts of unlabeled data. This is often faster than labeling data.

3) We would like to exploit “found” data such as that available on the Internet. Often this data is not truth-marked or is only partially transcribed.

4) Reversal of the training process: train on unlabeled data and then use supervision to label the groupings.

5) Models often need to be adapted over time.6) Use unsupervised methods to find features that will be useful for

categorization.7) Perform rapid exploratory analysis to gain insight into a new problem.

• In this chapter, we begin with parametric models and then step back and consider nonparametric techniques.

Page 3: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 3

Mixture Densities• Assume:

The samples come from a known number of c classes. The prior probabilities, P(j), for j = 1, …, c, are known,. The forms of the class-conditional probability densities, p(x|j,j) are known. The values for the c parameter vectors 1, …,c are unknown. The category labels are unknown.

• The probability density function for the samples is given by:

where = (1, …,c )t. P(j), the prior probabilities are called the mixing parameters and without loss of generality sum to one.

• A density, p(x|), is said to be identifiable if ’ implies there exists an x such that p(x|) p(x|’). (A density is unidentifiable if we cannot recover a unique from an infinite amount of data.)

• Identifiability of is a property of the model and not the procedure used to estimate the model.

• We have already discussed methods to estimate these mixture coefficients.

)(),|()|(1

jj

c

jj Ppp

xx

Page 4: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 4

Maximum Likelihood Estimates• Given a set D = {x1, …, xn} of n unlabeled samples drawn independently from

the mixture density, the likelihood of the observed samples is:

• The maximum likelihood estimate is the value of that maximizes p(D|).• If we differentiate the log-likelihood:

• Assume i and j are functionally independent if i j.• Substitute the posterior:

• The gradient can be written as:

• The gradient must vanish at the value of i that maximizes the log likelihood. Therefore, the ML solution must satisfy:

n

kkpDp

1)|()|( x

)(),|()|(

1))|((log11

jj

c

jjk

n

k kPp

pDp

ii

x

x

)|()(),|(),|(

k

iiikki p

PpPx

xx

),|(ln),|())|((log1

iik

n

kki pPDp

ii xx

ciforpP iik

n

kki i

,...,10)ˆ,|(ln)ˆ,|(1

xx

Page 5: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 5

• We can generalize these results to include the prior probability, P(i), among the unknown quantities.

• The search for the maximum value of p(D|) extends over and P(i), subject to the constraints:

• It can be shown that the ML estimate for the prior is:

• The first equation simply states the estimate of the prior is computed by averaging over the entire data set. The third equation we have seen before in the HMM section of this course. The second equation just restates the ML principle that the optimal value of produces a maximum.

• So the good news here is that doing the obvious maximizes the posterior.

Generalization of the ML Estimate

c

iii PciP

1.1)(,...,1,0)(

n

kkii P

nP

1)ˆ,|(ˆ1)(ˆ x

0)ˆ,|(ln)ˆ,|(ˆ1

iik

n

kki pP

i xx

c

jjjjk

iikki

Pp

pP

1)(ˆ)ˆ,|(

)ˆ,|()ˆ,|(ˆ

x

xx

Page 6: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 6

• If the only unknown quantities are the mean vectors, i, we can write:

and its derivative:

• The ML solution must satisfy:

• Rearranging terms:

• But this does not give us a new estimate explicitly, nor does it typically give closed form solutions. Instead, we can use a gradient-descent approach:

Unknown Mean Vectors

)()(21])2ln[()ˆ,|(ln 12/12/

iit

iid

iik --p xxx

)()ˆ,|(ln 1iiiik -p

i xx

tc

n

kikiki where-P )ˆ,...,ˆ(ˆ0ˆ)ˆ,|( 1

1

1

xx

n

kki

n

kkki

iP

P

1

1

)ˆ,|(

)ˆ,|(ˆ

x

xx

n

kki

n

kkki

ijP

jPj

1

1

))(ˆ,|(

))(ˆ,|()1(ˆ

x

xx

Page 7: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 7

Example

• Consider the simple two-component one-dimensional normal mixture.

• Generate 25 samples sequentially assuming 1 = -2 and 2 = 2.

• The likelihood function is calculated as a function of the estimates for the two means.

• We see that while the maximum is achieved near the true means, there are two peaks of comparable height:

1 = -2.130 and 2 = = 1.668

1 = 2.085 and 2 = -1.257.

Page 8: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 8

All Parameters Unknown

• If the means, covariances, and priors are all unknown, the ML principle yields singular solutions.

• If we only consider solutions in the neighborhood of the largest local maximum, we can derive estimation equations:

n

kkii P

nP

1)ˆ,|(ˆ1)(ˆ x

n

kki

n

kkki

iP

P

1

1

)ˆ,|(ˆ

)ˆ,|(ˆˆ

x

xx

n

kki

n

k

tikikki

iP

P

1

1

)ˆ,|(ˆ

)ˆ)(ˆ)(ˆ,|(ˆˆ

x

xxx

c

jjjkj

tjkj

iikit

iki

c

jjjik

iiikki

P--

P--

Pp

PpP

1

12/1

12/1

1)(ˆ]ˆˆˆ

21exp[ˆ

)(ˆ]ˆˆˆ21exp[ˆ

)(ˆ)ˆ,|(

)(ˆ)ˆ,|()ˆ,|(ˆ

xx

xx

x

xx

Page 9: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 9

• An approximate technique to determine the parameters of a mixture distribution is k-Means: k is the number of cluster centers, c, and “means” refers to the iterative process for finding the cluster centroids.

• We observe that the probability, , is large when the squared

Mahalanobis distance, , is small.

• Suppose we merely compute the squared Euclidean distance, , find the

mean nearest to xk, and approximate as:

• We can formally define the k-Means clustering algorithm: Initialize: select the number of clusters, c, and seed the means, 1, …, n. Iterate:o Classify n samples according to the nearest mean, i .o Recompute each mean using the ni samples assigned to cluster i.o Until: no change in i .

Done: return 1, …, n.

• Later we will see this is one case of an iterative optimization algorithm. There are many ways to cluster, recompute means, merge/split clusters and stop.

K-Means Clustering

)ˆ,|(ˆ kiP x

ikit

ik -- ˆˆˆ 1 xx

2ˆ ik-x

m̂ )ˆ,|(ˆ kiP x

otherwise

miifP ki 0

1)ˆ,|(ˆ x

Page 10: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 10

• In k-Means, each data point is assumed to reside in one and only one cluster.

• We can allow “fuzzy” membership – a data point can appear in a cluster with probability .

• We can minimize a heuristic global cost function:

where b is a free parameter that adjusts the blending of different clusters.• The probabilities of cluster membership for each point are normalized as:

• The relevant reestimation equations are:

• This can be viewed as a form of soft quantization, and fits nicely with our general notion of probabilistic modeling and EM estimation.

Fuzzy K-Means Clustering

2

1 1)]ˆ,|(ˆ[ ij

c

i

n

j

bjifuz PJ

xx

)ˆ,|(ˆ kiP x

c

ijiP

11)|(ˆ x

n

j

bji

n

jj

bji

jP

P

1

1

)]|(ˆ[

)]|(ˆ[

x

xx

c

r

bji

bji

jid

dP

1

)1/(1

)1/(1

)/1(

)/1()|(ˆ x

2ijjid x

Page 12: LECTURE  22:  CLUSTERING

ECE 8443: Lecture 22, Slide 12

Summary• Introduced the concept of unsupervised clustering.• Reviewed the reestimation equations for ML estimates of mixtures.• Discussed application to Gaussian mixture distributions.• Introduced k-Means and Fuzzy k-Means clustering.• Demonstrated clustering using the Java Pattern Recognition applet.